From: Maciej Sinilo <msinilo@kk...> - 2001-10-07 09:49:55
I know this have been discussed in archives, but no ultimate solution there.
The problem is exporting/importing templates to/from DLL. Classical
example is singleton -- I use something like:
template<typename T> class MySingleton
//... irrevelant stuff skipped
static T* ms_pInstance;
T* MySingleton<T>::ms_pInstance = 0;
[then you derive from MySingleton like MySingletonA :
This scheme works OK when dealing with static executables/libraries,
but it breaks when I use DLLs. The problem is that each DLL has its
own copy of ms_pInstance. Has anyone found a solution to this problem?
I know that similiar code works OK with MSVC.
[please ignore the spam appended to my message, I use free mail
http://www.zus.cc.pl tego potrzebujesz !