Subject: Re: DLL Problem
From: [email-masked] (Fergus Henderson)

23 Aug 1997 23:05:48 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Original-To: [email-masked]
Original-Sender: [email-masked]

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