How to use static members and singletons in dll's?
actually i'm working on a windows (MSYS/MinGW) migration of our Linux project. With Linux everything works fine, but with windows i got trouble with static members and singletons which have to be used over the context of different dlls.
I.e. I've an configuration mapper, which is a singleton build in a config.dll. If i use this dll inside differnd other dll, any dll got it's own instance. Is there a way to share the singleton access between those dlls?
I got also a failure using static members between dlls. If i call a static member of an vector class wich is placed in math.dll from any other dll i got this message during make:
Linking CXX shared library ../../lib/libbrGraphics.dll
Info: resolving binrev::brMath::brVector3f::NEGATIVE_UNIT_Z by linking to
__imp___ZN6binrev6brMath10brVector3f15NEGATIVE_UNIT_ZE (auto-i开发者_如何学Pythonmport)
Knowes anyone a solution? Best regards, Chris
A DLL is a library, if you want to share configuration data you will have to map the singleton on a shared memory map or use some other RPC mechanism. You wouldn't expect the error log on someone else's computer to be filled with what you print to stderr would you?
精彩评论