In my GUI application (MFC) I am using a dll to display something in the screen. I have a static library which having a singleton class for this. eg: sing.lib. I am including sing.lib in application (exe) project and in dll project(coz both uses this singleton class)
Issue is the instance getting in exe and in dll is different. Both calls the constructor!! see the singleton class code snippet.
class A
{
private:
A();
virtual ~A();
static A* m_pInstance;
public:
static A* GetInstance()
{
if (NULL == m_pInstance)
{
m_pInstance = new A();
}
return m_pInstance;
}
}