I have a class which needs to be a singleton. It implemented using a static member pointer:
class MySinglton
{
public:
static MySinglton& instance() { ... }
private:
static MySinglton* m_inst;
};
This class is compiled into a .lib which is used in multiple dlls in the same application. The problem is that each dll sees a different m_inst
. since it is compiled and linked separatly.
What is simple way to solve this problem?
Separating the .lib to its own dll is not an option. it must be a .lib.