From: bas AT healthcare DOT com ("Bret A. Schuhmacher") Subject: newbie dll question 16 May 1997 14:26:01 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199705161320.JAA12675.cygnus.gnu-win32@alt.healthcare.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Original-To: gnu-win32 AT cygnus DOT com X-Mailer: VM 6.22 under 19.15 XEmacs Lucid Original-Sender: owner-gnu-win32 AT cygnus DOT com Hi, I've been using gnu-win32 since back in the v16 days, but never seriously until now. I downloaded v18 recently and attempted to make a relocatable dll following all the instructions I could find (thanks to the people who forged the path :-)). All the files below were taken from the instructions at http://www.cygnus.com/misc/gnu-win32/building-reloc-dlls.txt. My problem is I can't resolve one symbol that appears to be related to the dll creation. Here's fixup.c : asm(".section .idata$3\n" ".long 0,0,0,0, 0,0,0,0"); Here's init.cc #include extern "C" { int WINAPI dll_entry (HANDLE h, DWORD reason, void *ptr); }; int WINAPI dll_entry (HANDLE , DWORD reason, void *) { switch (reason) { case DLL_PROCESS_ATTACH: break; case DLL_PROCESS_DETACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return 1; } Here's my "makedll" script: #! /bin/sh LIBPATH=//d/gnuwin32/b18/H-i386-cygwin32/i386-cygwin32/lib #tclMtherr.o \ #make a .def file echo EXPORTS > tclvc.def nm \ regexp.o tclAppInit.o tclAsync.o tclBasic.o tclCkalloc.o \ tclClock.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclDate.o tclEnv.o \ tclEvent.o tclExpr.o tclFCmd.o tclFHandle.o tclFileName.o tclGet.o \ tclHash.o tclHistory.o tclIO.o tclIOCmd.o tclIOSock.o tclIOUtil.o \ tclInterp.o tclLink.o tclLoad.o tclLoadNone.o tclMain.o \ tclNotify.o tclParse.o tclPkg.o tclPosixStr.o tclPreserve.o tclProc.o \ tclUnixChan.o tclUnixFCmd.o tclUnixFile.o tclUnixInit.o tclUnixNotfy.o \ tclUnixPipe.o tclUnixSock.o tclUnixTime.o tclUtil.o tclVar.o panic.o \ init.o fixup.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> tclvc.def #link DLL ld --base-file tclvc.base --dll -o tcl76.dll \ regexp.o tclAppInit.o tclAsync.o tclBasic.o tclCkalloc.o \ tclClock.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclDate.o tclEnv.o \ tclEvent.o tclExpr.o tclFCmd.o tclFHandle.o tclFileName.o tclGet.o \ tclHash.o tclHistory.o tclIO.o tclIOCmd.o tclIOSock.o tclIOUtil.o \ tclInterp.o tclLink.o tclLoad.o tclLoadNone.o tclMain.o \ tclNotify.o tclParse.o tclPkg.o tclPosixStr.o tclPreserve.o tclProc.o \ tclUnixChan.o tclUnixFCmd.o tclUnixFile.o tclUnixInit.o tclUnixNotfy.o \ tclUnixPipe.o tclUnixSock.o tclUnixTime.o tclUtil.o tclVar.o panic.o \ init.o fixup.o $LIBPATH/libcygwin.a -e _dll_entry AT 12 dlltool --as=as --dllname tcl76.dll --def tclvc.def --base-file tclvc.base \ --output-exp tclvc.exp ld --base-file tclvc.base tclvc.exp --dll -o tcl76.dll \ regexp.o tclAppInit.o tclAsync.o tclBasic.o tclCkalloc.o \ tclClock.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclDate.o tclEnv.o \ tclEvent.o tclExpr.o tclFCmd.o tclFHandle.o tclFileName.o tclGet.o \ tclHash.o tclHistory.o tclIO.o tclIOCmd.o tclIOSock.o tclIOUtil.o \ tclInterp.o tclLink.o tclLoad.o tclLoadNone.o tclMain.o \ tclNotify.o tclParse.o tclPkg.o tclPosixStr.o tclPreserve.o tclProc.o \ tclUnixChan.o tclUnixFCmd.o tclUnixFile.o tclUnixInit.o tclUnixNotfy.o \ tclUnixPipe.o tclUnixSock.o tclUnixTime.o tclUtil.o tclVar.o panic.o \ init.o fixup.o $LIBPATH/libcygwin.a -e _dll_entry AT 12 dlltool --as=as --dllname tcl76.dll --def tclvc.def --base-file tclvc.base \ --output-lib tcl76.a ld tclvc.exp --dll -o tcl76.dll \ regexp.o tclAppInit.o tclAsync.o tclBasic.o tclCkalloc.o \ tclClock.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclDate.o tclEnv.o \ tclEvent.o tclExpr.o tclFCmd.o tclFHandle.o tclFileName.o tclGet.o \ tclHash.o tclHistory.o tclIO.o tclIOCmd.o tclIOSock.o tclIOUtil.o \ tclInterp.o tclLink.o tclLoad.o tclLoadNone.o tclMain.o \ tclNotify.o tclParse.o tclPkg.o tclPosixStr.o tclPreserve.o tclProc.o \ tclUnixChan.o tclUnixFCmd.o tclUnixFile.o tclUnixInit.o tclUnixNotfy.o \ tclUnixPipe.o tclUnixSock.o tclUnixTime.o tclUtil.o tclVar.o panic.o \ init.o fixup.o $LIBPATH/libcygwin.a -e _dll_entry AT 12 #build the tclvc.a lib to link to dlltool --as=as --dllname tcl76.dll --def tclvc.def --output-lib tcl76.a #link with main gcc tclAppInit.c tcl76.a -o tclsh76.exe Here's the output when I run it: //d/gnuwin32/b18/H-i386-cygwin32/i386-cygwin32/lib/libcygwin.a(libccrt0.o)(.text+0x8a):libccrt0.cc: undefined reference to `GetModuleHandleA AT 4' //d/gnuwin32/b18/H-i386-cygwin32/i386-cygwin32/lib/libcygwin.a(libccrt0.o)(.text+0x8a):libccrt0.cc: undefined reference to `GetModuleHandleA AT 4' //d/gnuwin32/b18/H-i386-cygwin32/i386-cygwin32/lib/libcygwin.a(libccrt0.o)(.text+0x8a):libccrt0.cc: undefined reference to `GetModuleHandleA AT 4' Is libcygwin.a missing this symbol or is there another lib I should link with? Have I missed something obvious? I'll keep poking at my installation to see if I've hosed something. FWIW, my platform is NT4.0. Thanks for your thoughts! Rgds, Bret -- Bret A. Schuhmacher - Software Engineer bas AT healthcare DOT com These opinions are no one's Healthcare Communications, Inc. fault by my own. I stopped to think and forgot how to start again. - 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".