
Bjørn Roald <bjorn@4roald.org> writes:
Pavel Vozenilek wrote:
A library named Shmem is being developed (quite mature, can be found in sandbox).
With this or similar library one could allocate small, uniquely named memory block and singleton infrastructures from each DLLs would (behind the curtain) use it.
Then there would be no need for separate Win32 interface.
I agree that shared memory is one way to solve this. Note however that this is a problem that is specific to DLLs on windows -- where the meaning of C++ writeable static variables is broken. This is AFAIK not an issue with any other dynamic libraries like .so files in unix/linux. It is important to limit the workaround to the windows environment.
If you are referring to the fact that static variables with the same name can be allocated in multiple DLLs, so that you see different values from each DLL, your information is incorrect and I disagree with your characterization of it as "broken". GCC now supports restricting symbol visibility for ELF platforms. See http://www.nedprod.com/programs/gccvisibility.html As I see it, this model (essentially the Windows model) is actually much less broken than the usual one on Unix where everything forms a big "symbol soup." -- Dave Abrahams Boost Consulting www.boost-consulting.com