This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: DLL Problem


"Stephane Mariel" <stf@hugo.int-evry.fr> 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@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 <http://www.cs.mu.oz.au/~fjh/gnu-win32/how-to-build-dlls.html>.

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 <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]