Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. shared data segment

shared data segment

Scheduled Pinned Locked Moved C / C++ / MFC
sysadmindebuggingquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Abhi Lahare
    wrote on last edited by
    #1

    Hi all, I have two dll 1)DLLHook- global hook dll 2)BHODLL- a BHO dll and a server application 3) DlgApp in DLL hook i have #pragma data_seg(".shared") map<_tstring,_tstring> g_map; // Other objects ##pragma comment(linker, "/section:.shared,RWS") In DlgAPP, I am inserting some values in map. Now I have to use these value in BHODLL. While I debug the BHO, i do not see and values in the map. As per my understanding the global data section will be avaible in all the process after installing hook.so the map should be avaible in BHO code. Is these possible? or I am doing something wrong? Thanks in advance. Regards Abhi Lahare

    J 1 Reply Last reply
    0
    • A Abhi Lahare

      Hi all, I have two dll 1)DLLHook- global hook dll 2)BHODLL- a BHO dll and a server application 3) DlgApp in DLL hook i have #pragma data_seg(".shared") map<_tstring,_tstring> g_map; // Other objects ##pragma comment(linker, "/section:.shared,RWS") In DlgAPP, I am inserting some values in map. Now I have to use these value in BHODLL. While I debug the BHO, i do not see and values in the map. As per my understanding the global data section will be avaible in all the process after installing hook.so the map should be avaible in BHO code. Is these possible? or I am doing something wrong? Thanks in advance. Regards Abhi Lahare

      J Offline
      J Offline
      John M Drescher
      wrote on last edited by
      #2

      That can not work. This is because a map is allocates memory on the heap which does not work using shared data segments because the heap is not part of the shared data segment. You need to use a structure that at compile time allocates the maximum storage necessary and does this in the shared data segment.

      John

      B 1 Reply Last reply
      0
      • J John M Drescher

        That can not work. This is because a map is allocates memory on the heap which does not work using shared data segments because the heap is not part of the shared data segment. You need to use a structure that at compile time allocates the maximum storage necessary and does this in the shared data segment.

        John

        B Offline
        B Offline
        Blake Miller
        wrote on last edited by
        #3

        Or create a memory mapped file and don't use a shared data segment at all...

        Any sufficiently gross incompetence is nearly indistinguishable from malice.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups