title: Win32 DLL importing issues (DllMain)
body: <p>I have a native DLL that is a plug-in to a different application (one that I have essentially zero control of). Everything works just great until I link with an additional .lib file (links my DLL to another DLL named <code>ABQSMABasCoreUtils.dll</code>). This file contains some additional API from the parent application that I would like to utilize. I haven't even written any code to use any of the functions exported but just linking in this new DLL is causing problems. Specifically, I get the following error when I attempt to run the program:</p>
  
  <p><strong>The application failed to initialize properly (0xc0000025). Click on OK to terminate the application.</strong></p>
  
  <p>I believe I have read somewhere that this is typically due to a DllMain function returning FALSE. Also, the following message is written to the standard output:</p>
  
  <p><strong>ERROR: Memory allocation attempted before component initialization</strong></p>
  
  <p>I am almost 100% sure this error message is coming from the application and is not some type of Windows error.</p>
  
  <p>Looking into this a little more (aka flailing around and flipping every switch I know of) I linked with /MAP turned on and found this in the resulting .map file:</p>
  
  <pre><code> 0001:000af220       ??3@YAXPEAX@Z              00000001800b0220 f   ABQSMABasCoreUtils_import:ABQSMABasCoreUtils.dll
   0001:000af226       ??2@YAPEAX_K@Z             00000001800b0226 f   ABQSMABasCoreUtils_import:ABQSMABasCoreUtils.dll
   0001:000af22c       ??_U@YAPEAX_K@Z            00000001800b022c f   ABQSMABasCoreUtils_import:ABQSMABasCoreUtils.dll
   0001:000af232       ??_V@YAXPEAX@Z             00000001800b0232 f   ABQSMABasCoreUtils_import:ABQSMABasCoreUtils.dll
  </code></pre>
  
  <p>If I undecorate those names using "undname" they give the following (same order):</p>
  
  <pre><code>void __cdecl operator delete(void * __ptr64)
  void * __ptr64 __cdecl operator new(unsigned __int64)
  void * __ptr64 __cdecl operator new[](unsigned __int64)
  void __cdecl operator delete[](void * __ptr64)
  </code></pre>
  
  <p>I am not sure I understand how anything from <code>ABQSMABasCoreUtils.dll</code> can exist within this .map file or why my DLL is even attempting to load ABQSMABasCoreUtils.dll if I don't have any code that references this DLL. Can anyone help me put this information together and find out why this isn't working? For what it's worth I have confirmed via "dumpbin" that the parent application imports <code>ABQSMABasCoreUtils.dll</code>, so it is being loaded no matter what. I have also tried delay loading this DLL in my DLL but that did not change the results.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have double checked and all files involved are 64 bit.</p>