Singelton restricted to instance of dll
Posted
by
codeySmurf
on Stack Overflow
See other posts from Stack Overflow
or by codeySmurf
Published on 2011-02-20T23:22:26Z
Indexed on
2011/02/20
23:25 UTC
Read the original article
Hit count: 151
If I create a singleton class in the context of a dll, the singleton class is instantiated once and used by all instances of the dll. I am using a dll as a plug-in for an application. Now the following thing came to my mind: If I use a singleton Class, it will be shared across multiple instances of the plug-in. However, this makes it difficult to manage the lifetime of the singleton class efficiently. The only way I could think of would be to use a reference count and to make the singleton delete its self when the reference count is 0.
Does anyone have any better ideas on that? Is there any good way to restrict the singleton object to one instance of the dll?
Language is c++
© Stack Overflow or respective owner