简体   繁体   中英

global variable used across different shared libraries

I am using a global pointer to a linked list (which holds a pointer to an element and a pointer to the next node) which is initialized by one DLL. This global variable is shared across different DLLs (shared objects).

Earlier when the system comes up with the global list, it gets initialized and all the DLLs have the value for the list. Later while system is running one DLL (say x.so) have deleted the memory and re-initialized the entire list, and when the other DLL (let say y.so) tries to read the values it always get the older values. Any clue why is this happening and how to over come from this issue?

I read somewhere that the heap area is shared across the DLLs, I am not sure why I am facing this issue. Any help will be appreciable.

The heap is shared between DLLs in the same process but different processes have distinct heaps. It sounds like you have global variables in a DLL that is loaded into distinct processes. That cannot be shared without some form of inter-process communication.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM