From: khan AT xraylith DOT wisc DOT edu (Mumit Khan) Subject: Re: undefined references 29 Jan 1999 23:38:39 -0800 Message-ID: References: <36B0B2C4 DOT CD81972E AT uiuc DOT edu> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII To: Brian Ryner Cc: gnu-win32 AT cygnus DOT com On Thu, 28 Jan 1999, Brian Ryner wrote: > Hi- > > I'm attempting to port Mozilla's NSPR library to compile under Cygwin. > I'm using B20.1, and the egcs 1.1.1 binaries from the cygwin site. I'm > having a problem when it tries to build the DLL. The command line it's > running and the errors that are generated are attached below. It seems > like I'm not linking to the right libraries, but I can't figure out > which ones exactly. Below the output I've also attached some of the > lines of code where it says the undefined references are. Any help is > much appreciated. > > ld --dll -o WIN954.0_DBG.OBJ/libnspr21.dll -e _DllMain AT 12 --base-file Few comments: 1. Don't use ld directly (if you do, you'll need to supply all the requisite libraries, such as -lcygwin and startup files manually); use `gcc'. 2. Use dllwrap to build the DLLs until DJ Delorie's work on ld to create DLLs directly is releases (or you could ask him to be a tester!). 3. _DllMain AT 12 is not correct entry point for Cygwin native programs. It's __cygwin_dll_entry AT 12, which it dllwrap supplies for you. $ dllwrap -o foo.dll foo1.o foo2.o -lbar1 -lbar2 I'm assuming that you're trying to link with MSVC created objects, nor are you trying to load this DLL from an MSVC app using LoadLibrary. If it's the latter, use __cygwin_noncygwin_dll_entry AT 12 as the entry point (``dllwrap --entry __cygwin_noncygwin_dll_entry AT 12''). Regards, Mumit - 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".