• Advertisement
Sign in to follow this  

DLL export and Singleton

This topic is 4468 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

so, i had stumble on the problem: "needs to have dll-interface to be used by clients..". I solved it with:
[SOURCE]


#ifdef EXPORT
#define API __declspec(dllexport)  
#define EXPIMP_TEMPLATE 
#else                                  
#define API __declspec(dllimport)  
#define EXPIMP_TEMPLATE extern
#endif

EXPIMP_TEMPLATE template class API std::list<CNode*>;


[/SOURCE]
and it works fine, excpet thoose nasty warnings...anyway...no to the problem, i got a Singleton baseclass which includes a static member(the singleton) and the problem is when i use the DLL in my exe file, because there will be 2 instances of this singleton, one in the DLL and one in the exe. Is there any way to solve this? exporting the static member in a way so its only refered to the one in the DLL file? / thanks

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement