From: cvn AT interchain DOT nl (Kees van Veen) Subject: Re: questions from an average user 19 Dec 1997 07:23:17 -0800 Message-ID: <349A7D51.4702197D.cygnus.gnu-win32@interchain.nl> References: <34990805 DOT 56E05C26 AT greco2 DOT polytechnique DOT fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------4021AC1F2E54429159796286" To: Alessandro Mirone Cc: Gnu win32 This is a multi-part message in MIME format. --------------4021AC1F2E54429159796286 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Alessandro Mirone wrote: > > - If someone who is able to build DLLs could contact me it would > be of great help for me > I have had terrible trouble to get DLLs build and running on Windows95 until I got hold of dllfix.exe (a tool to repair bad .reloc section endings). Currently I'm running on W95 and NT 4.0 SP3 B18 with Sergey's coolview with applications calling 5 or 6 DLLs without problems. One problem is still that I seem to have to call _getenv instead of getenv, _execl instead of execv, etc. to get it running when linked to DLLs. I don't know why, see my mail on environment variables and DLLs sometime back. I attached my shell script to build DLLs with, maybe it is of some help to you (you may need to edit it). Kees P.S. if you can't find dllfix.exe, I'll send it to you --------------4021AC1F2E54429159796286 Content-Type: text/plain; charset=us-ascii; name="mymakedll" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mymakedll" #! /bin/sh # Script to compile and link a relocatable DLL # For usage see below # # Files that make up the DLL = $* and $DLLENTRY.cc $FIXUP.c. # ($DLLENTRY.cc and $FIXUP.c are housekeeping routines needed for the DLL. if [ "$1" = "-g" ]; then DEBUG="-g"; fi if [ "$1" = "-s" ]; then USRLIBS="$2"; shift; shift; fi if [ "$4" = "" ] then echo "Usage: `basename $0` [-g] [-s link-opts] dirname libname object..." exit 1 fi DIR=$1; shift; LIB=$1; shift; SYSLIBS="$USRLIBS -L`dirname \`gcc -print-file-name=libcygwin.a | sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1 AT g' -e 's@\\\\\\\\@/@g' \` ` -lc -lcygwin -lkernel32 -lc" DLLENTRY=dllentry FIXUP=dllfixup # Generate an entry point routine echo ' #include #include extern "C" { extern struct _reent *_impure_ptr; extern struct _reent *__imp_reent_data; __attribute__((stdcall)) int WINAPI dll_entry (HANDLE h, DWORD reason, void *ptr); }; int WINAPI dll_entry (HANDLE, DWORD reason, void*) { _impure_ptr=__imp_reent_data; switch (reason) { case DLL_PROCESS_ATTACH: break; case DLL_PROCESS_DETACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return 1; } ' >$DLLENTRY.cc # This is needed to terminate the list of import stuff */ # Copied from winsup/dcrt0.cc in the cygwin32 source distribution. */ echo ' asm(".section .idata$3\n" ".long 0,0,0,0, 0,0,0,0");' > $FIXUP.c # Compile the generated sources gcc -c $DLLENTRY.cc $FIXUP.c # Make .def file: echo EXPORTS > $LIB.def nm $* $DLLENTRY.o $FIXUP.o | grep '^........ [BCDRT] _' | sed 's/[^_]*_//' >> $LIB.def # Link DLL. ld $DEBUG --base-file $LIB.base --dll -o $DIR/$LIB.dll \ $DLLENTRY.o $FIXUP.o $* $SYSLIBS -e _dll_entry AT 12 dlltool --as=as --dllname $LIB.dll --def $LIB.def \ --base-file $LIB.base --output-exp $LIB.exp ld $DEBUG --base-file $LIB.base $LIB.exp --dll -o $DIR/$LIB.dll \ $DLLENTRY.o $FIXUP.o $* $SYSLIBS -e _dll_entry AT 12 dlltool --as=as --dllname $LIB.dll --def $LIB.def \ --base-file $LIB.base --output-exp $LIB.exp ld $DEBUG $LIB.exp --dll -o $DIR/$LIB.dll $DLLENTRY.o $FIXUP.o $* \ $SYSLIBS -e _dll_entry AT 12 dllfix $DIR/$LIB.dll >/dev/null 2>&1 # Build the $LIB.a lib to link to: dlltool --as=as --dllname $LIB.dll --def $LIB.def \ --output-lib $DIR/$LIB.a rm -f $DLLENTRY.cc $DLLENTRY.o $FIXUP.c $FIXUP.o \ $LIB.base $LIB.exp $LIB.def --------------4021AC1F2E54429159796286-- - 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".