title: Access a member variable in Singleton object from EXE and DLL
body: <p>I am writing a singleton logger with logging level for my exe and dll.</p>
  
  <p>The Logger.h:</p>
  
  <pre><code>#define LOG CLogger::GetInstance().Log
  #define LOG_PATH _T(".\\LogFile\\Logger.log")
  enum eLogLevel { NONE=0, ERR, WARNING, USER, SYSTEM, DEVELOPER };  
  
  class CLogger  
  {
  public:
      //Construcor &amp; Destructor
                      CLogger();
      virtual             ~CLogger();
      //Singleton 
      static CLogger&amp;     GetInstance();          
      //For logging level preference
      //Example: WARNING -&gt; Log only ERR &amp; WARNING messages
      //Default = NONE
      virtual void        SetLogLevel(eLogLevel eLevel);  
      //Logging
      virtual void        Log(eLogLevel eLevelType, CString szText);  
  
  protected:
      //Open &amp; Close the log after used
      virtual void        CloseLog();
      virtual BOOL        OpenLog();
  
      CStdioFile      m_File;
      CString         m_szFile;
      eLogLevel       m_eLevel;
      BOOL            m_bFileOpened;
  };
  </code></pre>
  
  <p>The idea is, EXE project will need to include Logger.cpp &amp; Logger.h, responsible to set the logging level.</p>
  
  <p>Meanwhile, DLL project will need to include Logger.cpp &amp; Logger.h, but no need to set the logging level, as it will follow the logging level of EXE project.</p>
  
  <p>Both of EXE &amp; DLL are expected to able to write anything into the same log file.</p>
  
  <p>The outcome now is, I will need to ask DLL project to SetLogLevel() so that DLL project is able to write into log file.</p>
  
  <p>Can anyone spot the problem on the Logger.h above? Wouldn't the Singleton sharing one instance of object including member variables, as EXE &amp; DLL will be running on the same process/thread?</p>