Subject: Makefile.DLLs dll_init.c doesn't link
From: Christopher Hicks <[email-masked]>
To: Cygwin Discussion List <[email-masked]>
Date: Fri, 20 Jul 2001 19:00:12 -0400 (EDT)

I've tried following the instructions on creating DLL's under win32 found
at:
	http://www.cs.mu.oz.au/~fjh/gnu-win32/how-to-build-dlls.html
I've run into a minor problem and I wonder if someone may have seen it
before.  Everything goes well until it tries to do the ?final link and it
has a problem compiling dll_init.c which is generated in Makefile.DLLs.
This is the output I get:

------------------------------make output-------------------------------
dlltool  		\
	--def pal2bsv.def					\
	--dllname pal2bsv.dll				\
	--output-exp pal2bsv.exp				\
	--output-lib pal2bsv_dll.a
echo "/* automatically generated by Makefile.DLLs */"	> pal2bsv_dll.c
echo "void *_impure_ptr;"				>> pal2bsv_dll.c
gcc    -c -o pal2bsv_dll.o pal2bsv_dll.c
ld   --dll -o pal2bsv.dll			\
	-e _dll_entry@12 					\
	pal2bsv.exp pal2bsv.a pal2bsv_dll.o				\
	dll_init.o dll_fixup.o					\
	 					\
	-L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5 -L/usr/lib
-L/usr/lib/w32api -lgcc -lcygwin -lkernel32 -lgcc
pal2bsv.a(genfunc.o)(.text+0x17b):genfunc.c: undefined reference to
`MessageBoxA@16'
dll_init.o(.text+0x4):dll_init.c: undefined reference to
`__imp_reent_data'
make: *** [pal2bsv.dll] Error 1
rm pal2bsv.exp pal2bsv_dll.o pal2bsv_dll.c
------------------------------make output-------------------------------

The source for dll_init.c that is produced by Makefile.DLLs is:
------------------------------dll_init.c--------------------------------
#include <stdio.h>
extern struct _reent *_impure_ptr;
extern struct _reent *__imp_reent_data;
__attribute__((stdcall))
int dll_entry(int handle, int reason, void *ptr)
{ _impure_ptr=__imp_reent_data; return 1; }
------------------------------dll_init.c--------------------------------

I'm using the latest version of cygwin just installed a few days ago on an
NT4 Workstation with service pack 6 on it.

-----------------------------screen output------------------------------
$ gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
gcc version 2.95.3-5 (cygwin special)

chicks@CHICKS_NT4WKS ~
$ ld -v
GNU ld version 2.11.90 (with BFD 2.11.90)
-----------------------------screen output------------------------------

Any suggestions would be greatly appreciated.  It's been a long time since
I've done DLL development for Windows and when I was doing it long ago I
used Borland C++.

-- 
</chris>

Given enough time and money, eventually Microsoft will re-invent UNIX.
                      -- From a Slashdot.org post

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/