in Windows (XP at least) a static declared variable seems not to be consistent over DLL boundaries. So for a static variable declared inside the application &(my_static_var) called from the application returns an other address that called from inside a DLL-function.
Knowing that, I always avoided static variables in my windows apps which uses DLLs.
Unfortunately now I have to integrate a static linked (c-)library which internally uses a static declared variable to save a handle after an init-like library function is called. Because that handle is only valid inside one context (depending from where I called the init function inside the application or an DLL), my design is pretty broken.
Is there maybe any linker option or anything to change the default behavior, so all the DLLs as well as the main application uses the same memory for static variables?
Thank you in advance!