Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <4151FEB1.2030004@hones.org.uk> Date: Wed, 22 Sep 2004 23:37:37 +0100 From: Cliff Hones User-Agent: Mozilla Thunderbird 0.7.2 (Windows/20040707) MIME-Version: 1.0 To: Cygwin List Subject: Re: Lot of undefined symbols at link time, even with -l option on good libraries References: <4151B11A DOT 2020209 AT atosorigin DOT com> <6 DOT 1 DOT 0 DOT 6 DOT 0 DOT 20040922133349 DOT 03eb1438 AT pop DOT prospeed DOT net> In-Reply-To: <6.1.0.6.0.20040922133349.03eb1438@pop.prospeed.net> X-Enigmail-Version: 0.84.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i8MMbnJg027592 Larry Hall wrote: > At 01:14 PM 9/22/2004, you wrote: > >>>-----Original Message----- >>>From: Frédéric ORMANCEY >>>Sent: 22 September 2004 18:07 >> >>>I did it, but it don't work ! >> >> Ah, ok, that was not clear from your last message! >> >> >>>The --enable-stdcall-fixup option suppress one warning on top >>>of linker output trace : >>> AVERTISSEMENT: résolution de _GetModuleHandleA par un >>>lien vers _GetModuleHandleA AT 4 >>>and unfortunatly leave ALL other errors with no effect on it. >> >> I see. Hmm. That's very strange; it should affect all the errors - that >>is, if they're all the same kind of error. OTOH it could be that you've >>gotten the calling conventions wrong with the other pragmas, so that's why >>--enable-stdcall-fixup doesn't work for them; there must be some different >>reason why the errors are caused, since they behave differently. >> >> You might care to experiment with the "--enable-auto-import" and, failing >>that, "--enable-extra-pe-debug" options as well. > > Or Frédéric could try specifying the link symbol he wants in the pragma > as suggested by an earlier poster (sorry, the thread is broken in the > archives and I didn't put any effort into wading through the messages > to trace it all back to that message). That was me - but it seems Dave Korn's post broke the thread. But isn't it easy enough to sort messages on subject? Anyway, I tried a noddy example, as follows... Cliff AT enigma ~ $ cat imp.adb procedure imp is procedure Doit(A : integer; B : boolean; C : character); pragma Import (Stdcall, Doit, "FormatMessageA"); begin Doit(1, true, 'x'); end; Cliff AT enigma ~ $ gnat compile imp.adb gcc -c imp.adb Cliff AT enigma ~ $ nm imp.o 00000000 b .bss 00000000 d .data 00000000 t .text U _FormatMessageA AT 12 00000000 T __ada_imp So Gnat is generating a stdcall-style linker symbol with @12 (the parameter block size) correctly appended. If Frédéric is not seeing this with stdcall, it is probably an indication that the specification used for Doit is wrong - ie it hasn't been defined to take any parameters. If you change the pragma line to pragma Import (Stdcall, Doit, Link_Name => "FormatMessageA"); the symbol is generated as U FormatMessageA AT 12 so you can generate it without the leading underscore, but with the stdcall postfix, if you wish. [Note - the above is just an example - the *real* FormatMessageA should take 7 words (28 bytes) of parameters, and the Ada spec should match the kernel32 definition.] -- Cliff -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/