|
From: <sp...@op...> - 2001-07-12 21:59:55
|
Hi,
I'm trying to use mingw to compile a MSVC mathcad DLL. The version of
mingw is:
gcc version 2.95.3-4 (mingw special)
The source compiles ok, but when linking, I get the error:
undefined reference to `_CRT_INIT@12'
The compilation/linking commands that I'm using are:
gcc -c multiply.c
dllwrap --export-all --output-def mult.def --implib mult.a -o multiply.dll
multiply.o mcaduser.lib
I've tried stripping off the _CRT_INIT and whilst the code then links, it
doesn't work.
The offending lines in the source code follow.
Any suggestions about how to fix it would be much appreciated. Apologies
if this is obvious/in the faq - I've looked but with no success.
Thanks,
Simon (sp...@op...)
...snipped the start off the code...
BOOL WINAPI _CRT_INIT(HINSTANCE hinstDLL, DWORD dwReason, LPVOID
lpReserved);
BOOL WINAPI DllEntryPoint (HINSTANCE hDLL, DWORD dwReason, LPVOID
lpReserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
//
// DLL is attaching to the address space of
// the current process.
//
if (!_CRT_INIT(hDLL, dwReason, lpReserved))
return FALSE;
// register the error message table
// Note, that if your function never returns
// an error -- you do not need to
// register an error message table
if ( CreateUserErrorMessageTable(
hDLL, NUMBER_OF_ERRORS, myErrorMessageTable ) )
// and if the errors register OK
// go ahead and
// register user function
CreateUserFunction( hDLL, &multiply );
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
if (!_CRT_INIT(hDLL, dwReason, lpReserved))
return FALSE;
break;
}
return TRUE;
}
Simon Prince,
Senior Optical Engineer,
Optics 1 Inc.,
3050 Hillcrest Drive, Ste. 100
Westlake Village, CA 91362
USA.
Phone: (805) 373 9340
Fax: (805) 373 8966
Email: sp...@op...
|