Hey,

Here is my problem :

i am building an exectutable which relies on two Dlls, one is the "core" and the other is "engine"

in Core, i define a Singleton class :

Code:
template< class T >
class Singleton
{
   static T* instance;
public:
   Singleton() : instance(reinterpret_cast<T*)(this)) {}
   static T* getInstance() { assert(instance); return instance; }
};
in Engine, i use this Singleton :
Code:
class Toto : public Singleton<Toto>
{
};

void register_toto(); //this function creates the singleton from within the engine, just calling new(Toto)
at last, in the exe, i use the instance :
Code:
Toto::getInstance();
which raises...or not the assert. Under Visual Studio it seems to work OK, but under mingw the singleton is a static member initialized in engine, and since it's in a header file, the exe also got its own copy of the static member, and thinks it's not initialized. So i have an initialized singleton in Engine and an empty one in the program.

what can I do to have only one static member both for the Dll and the exe?