Sign in to follow this  

DLL export and Singleton

Recommended Posts

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

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

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

and it works fine, excpet thoose nasty 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this