From: fjh AT cs DOT mu DOT OZ DOT AU (Fergus Henderson) Subject: Re: DLL Problem 23 Aug 1997 23:05:48 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199708210837.SAA12023.cygnus.gnu-win32@mundook.cs.mu.OZ.AU> References: <199708201219 DOT OAA01103 AT hugo DOT int-evry DOT fr> Original-To: gnu-win32 AT cygnus DOT com Original-Sender: owner-gnu-win32 AT cygnus DOT com "Stephane Mariel" writes: >I'm trying to port a tcl module from unix to win95 as a dll to load within >wish. > >ext+0x1e):libcmain.cc: undefined reference to `WinMain AT 16' > >This seems to be a reentrancy problem, since a simple call like : >fprintf(stderr, ...) >makes use of _impure_ptr which is a struct _reent* ptr that is provided by >any process using the dll. So , probably the exact question is : how to say >to ld: this symbol must not be search in libc, (libccrto.o, libcmain.o) but >must be mapped to a symbol defined in the calling process? With beta-18, you need to define _impure_ptr in your DLL. See . An extract: # The DLL may also contain some references to _impure_ptr # (e.g. stdin is defined as a macro which expands to _impure_ptr.stdin). # We need to provide a definition for this (otherwise it will link in # the definition in libccrt.o, which causes lots of problems, # eventually leading to undefined symbol `WinMain'). # The main program needs to initialize all the _impure_ptr variables # for the DLLs with its _impure_ptr. -- Fergus Henderson | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh AT 128 DOT 250 DOT 37 DOT 3 | -- the last words of T. S. Garp. - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".