title: class not instantiating in dll
body: <p>I have built an MFC project (executable) as dll or more accurately I have added export functions to it just like a dll. I can load and execute the exported functions however the problem is that when I load the module, the main application class <code>CMyApp theApp</code>doesn't get instantiated. This means I can't use the <code>theApp</code> object which I really want to. I have even modified the function below so it matches that of a standard MFC dll.</p>
  
  <pre><code>BOOL CMyApp::InitInstance()
  {
     CWinApp::InitInstance();
  
     return TRUE;
  }
  </code></pre>
  
  <p>I am using <code>LoadLibrary()</code> to load the exe/dll. Note, I am not exporting any c++ class from dll, just few standard C style functions. These functions internally would like to use the main application object but it is not instantiated (its constructor is never called). What do I need to do the app class is instantiated properly just like it would in a standard mfc dll?</p>
  
  <p>** <strong>Update</strong> **</p>
  
  <p>Ideally I would like to have the exported functions available in exe itself and I have already done that but when I load it with <code>LoadLibrary</code> the application <code>theApp</code> class doesn't get instantiated. I believe this is same behavior even if it was a dll. My projects has many dependencies and creating a new dll project and adding all files and libraries is too cumbersome. I would really like to change the project settings of the current project if any so I can have it loaded with the application class properly instantiated just like a regular MFC dll. But the question is what project settings I need to change?</p>
  
  <p>Note: I will take out instantiating of main dialog object with <code>#define</code>. Basically the dll version of <code>InitInstance()</code> function can be as simple the one I posted above.</p>