From: amsdenz@aavid.com (Amsden, Zachary)
Subject: Linking libcrt in DLL files
4 Jun 1998 07:32:13 -0700
Message-ID: <D0FB11F70375D111ADC000600833E4F59925EC.cygnus.gnu-win32@HERCULES>
Mime-Version: 1.0
Content-Type: text/plain
To: gnu-win32@cygnus.com

Is it possible to link the C runtime library in DLL files?   I am trying
to compile some 
Microsoft code from the latest platform SDK, specifically the spincube
dll example and test.   
I am using the mingw32-gcc distrubution with the latest tools.

I can not get the DLL to compile because it complains about 
missing references to _CRT_INIT.  Checking the source code,
it seems:

BOOL WINAPI DllMain (HANDLE hDLL, DWORD dwReason, LPVOID lpReserved)
  ....
*               If your DLL uses any C runtime functions then you should
*               always call _CRT_INIT so that the C runtime can
initialize
*               itself appropriately. Failure to do this may result in
*               indeterminate behavior. When the DLL entry point is
called
*               for DLL_PROCESS_ATTACH & DLL_THREAD_ATTACH
circumstances,
*               _CRT_INIT should be called before any other
initilization
*               is performed. When the DLL entry point is called for
*               DLL_PROCESS_DETACH & DLL_THREAD_DETACH circumstances,
*               _CRT_INIT should be called after all cleanup has been
*               performed, i.e. right before the function returns.
*
\***********************************************************************
*******/


So it seems I need to call an initialization function for the C runtime
library.  My question is:
Which library is this function located in?  Should I call a mingw32 CRT
init function, or do I
call a MS CRT init function?  What is this function called?  Has anyone
run into similar
problems?

Thanks,
Zachary Amsden
amsden@andrew.cmu.edu

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
