From: giac AT dalim DOT de ("Philippe GIACINTI") Subject: Re: helpful hints to build dlls in Win32 using cygwin (gnu) 1 Aug 1997 06:52:46 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <9708011319.ZM28568.cygnus.gnu-win32@pion.kehl.dalim.de> References: <33E0F327 DOT DF8B81B3 AT Eng DOT Sun DOT COM> <199708010456 DOT OAA10715 AT mundook DOT cs DOT mu DOT OZ DOT AU> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: Fergus Henderson "Re: helpful hints to build dlls in Win32 using cygwin (gnu)" (Aug 1, 2:56pm) X-Face: ^cJc2\tiS@#Ja AT 7laz+N]T)kL{-Kay)Oz"?}p[wuY#}}dO"enP!QVO{,}&4P2V[hEfJD]9& E1ou~|tY/|9d&7c,7yf>7n: Zj8FD(LtPXWHzy^OJIDi/~O~R]3x/5}"7P;|,*%f:3Z!>h8Ff/&)g?/ }$RXQ X-Mailer: Z-Mail (3.2.3 08feb96 MediaMail) Original-To: gnu-win32 AT cygnus DOT com Original-Sender: owner-gnu-win32 AT cygnus DOT com Fergus Henderson writes: >Padmakar Vishnubhatt writes: > >>I did exactly as u recommended in your hints - and yet I get the >>following error when I run the linker (ld). Am I missing something in >>the cygwin distribution? >> >>/gnuwin32/b18/H-i386-cygwin32/i386-cygwin32/lib/libcygwin.a(libccrt0.o)(.text+0x >>8a):libccrt0.cc: undefined reference to `GetModuleHandleA AT 4' > >Your problem is due to `_impure_ptr'. (By the way, to debug these >sorts of problems, use the `-Map' and `--cref' options to `ld'.) >libccrt0.o should not be linked in to DLLs at all. >The reason that it does get linked in is because it defines `_impure_ptr', >which is referenced by your code (implicitly, e.g. because stdout >is #defined as `_impure_ptr._stdout'), and which is >not defined anywhere else. > >You need to provide a definition of `_impure_ptr'. >You also need to initialize it (otherwise references to stdout >etc. in your DLL will be bogus). > The problem of definition and initialization of _impure_ptr is solved in my previous patch. If you use this patch you must link your dll with libccrt0.o and then you have to add -lkernel32 to your link line ... regards. -- ========================================================================== | Philippe GIACINTI | | | | DALiM GmbH R&D email: giac AT dalim DOT de | | Daimler Strasse 2, tel: +49.7851.9196-28 | | D-77694 Kehl-Sundheim Germany fax: +49.7851.73576 | | | ========================================================================== - 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".