Sign in to follow this  
Keba

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:
[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

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