title: Global variable destructors not called, where to start?
body: <p>I'm faced with the problem that my applications global variable destructors are not called. This seems to occur only if my application successfully connects to an oracle database (using OCI).</p>
  
  <p>I put some breakpoints in the CRT and it seems that DllMain (or __DllMainCRTStartup) is not called with DLL_PROCESS_DETACH, thus no atexit() is called which explains why my destructors are not called.
  I have no idea why this happens.</p>
  
  <p>I realize that this is probably not enough information to be able to indicate the cause, but my question is: What would be a good start to look for the cause of this problem?</p>
  
  <p>This is a list of things I already tried:</p>
  
  <ul>
  <li>search the net for solutions</li>
  <li>attached the debugger and enable native exceptions to see there was no hidden crash, sometimes I get an exception in the .Net framework, but the app seems to continue.</li>
  <li>try to reproduce in a small application, no success</li>
  </ul>