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


> I'm trying to port a tcl module from unix to win95 as a dll to load within
> wish.
>
> So i tried to began with the example provided on cygnus.com , it works
> fine, i got my foo.dll, main.exe, but moving to my real software when I run
> ld I got:
> c:/gnuwin32/b18/H-i386-cygwin32/i386-cygwin32/lib/libcygwin.a(libccrt0.o)(.t
>
> ext+0x8a):libccrt0.cc: undefined reference to `GetModuleHandleA@4'
> c:/gnuwin32/b18/H-i386-cygwin32/i386-cygwin32/lib/libcygwin.a(libcmain.o)(.t
>
> ext+0xc):libcmain.cc: undefined reference to `GetModuleHandleA@4'
> c:/gnuwin32/b18/H-i386-cygwin32/i386-cygwin32/lib/libcygwin.a(libcmain.o)(.t
>
> ext+0x15):libcmain.cc: undefined reference to `GetCommandLineA@0'
> c:/gnuwin32/b18/H-i386-cygwin32/i386-cygwin32/lib/libcygwin.a(libcmain.o)(.t
>
> ext+0x1e):libcmain.cc: undefined reference to `WinMain@16'
>
> This seems to be a reentrancy problem, since a simple call like :
> fprintf(stderr, ...)

...for me this seems to be a forgotten '-lkernel32' at link-time :). The
undefined ref to 'WinMain' can be avoided with:

        echo 'int main() { return 0; }' > fixup.c;
        echo 'asm (".section .idata$3\n" ".long 0,0,0,0,0,0,0,0");' >> fixup.c;
        gcc -c fixup.c
        # link fixup.o with your dll...

hth,

--- Roland.

---
Roland Geier                    Phone: ++49 (8505) 92182          
Universitaet Passau, GER 	Fax:   ++49 (8505) 922311
Lehrstuhl Prof. Dr. Donner      geier@forwiss.uni-passau.de	
D-94032 Passau                  http://www.uni-passau.de/~geier/





-
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]