delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/21/12:46:36

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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: <41505AD3.9010701@hones.org.uk>
Date: Tue, 21 Sep 2004 17:46:11 +0100
From: Cliff Hones <cliff AT hones DOT org DOT uk>
User-Agent: Mozilla Thunderbird 0.7.2 (Windows/20040707)
MIME-Version: 1.0
To: Cygwin List <cygwin AT cygwin DOT com>
Subject: Re: Lot of undefined symbols at link time, even with -l option on good libraries
References: <414FF698 DOT 4010702 AT atosorigin DOT com> <6 DOT 1 DOT 0 DOT 6 DOT 0 DOT 20040921091604 DOT 03d5b528 AT pop DOT prospeed DOT net> <41505394 DOT 9020105 AT atosorigin DOT com> <6 DOT 1 DOT 0 DOT 6 DOT 0 DOT 20040921122405 DOT 03dca210 AT pop DOT prospeed DOT net>
In-Reply-To: <6.1.0.6.0.20040921122405.03dca210@pop.prospeed.net>
X-Enigmail-Version: 0.84.2.0
X-Enigmail-Supports: pgp-inline, pgp-mime
X-IsSubscribed: yes

Larry Hall wrote:
> At 12:15 PM 9/21/2004, you wrote:
> 
>>I think you're right, it seems to be a problem with trailing underscore in function naming.
>>For example :
>>
>>in /usr/lib/w32api/libkernel32.a we found :
>>
>>  00000000 T _FormatMessageA AT 28
>>                   U __head_libkernel32_a
>>  00000000 I __imp__FormatMessageA AT 28
>>
>>which is required by win32-winbase.o, result of the build of /usr/lib/gcc/win32ada/win32-winbase.adb
>>       U _FormatMessageA
>>       U _FormatMessageW
>>       U _GlobalReAlloc
>>       U _LocalReAlloc
>>
>>The source code for this part is the following :
>> pragma Import (Stdcall, Doit, "FormatMessageA");
>>
>>I try change it with pragma Import (C, Doit, "_FormatMessageA"); or things like that with no success.
>>
>>May be it's the trailing @28 after symbol name which cause error, but I cannot control it ( it's DLL calling convention parameter size ). Compiler/linker should usually add or remove trailing @nn if necessary.
>>
>>To answer your general questions, I'am building a large Ada application ( 200 source files ), using W32 API, with Win2000 GNAT Compiler.
> 
> Sorry, I know nothing about Ada and how it works.  If the "pragma" statement
> is supposed to take the place of the traditional function prototype in C/C++,
> then I agree that it looks "OK" (again, based on my knowledge of Ada).  But
> the result is that it's looking for symbols that use the 'C' calling 
> convention rather than the 'stdcall' calling convention.  The libraries you
> are linking to want the 'stdcall' calling convention (since it is the 
> default for Windows).  If you cannot get Ada to ask for the proper symbol, 
> you could try using the '--enable-stdcall-fixup' option (for 'ld') to 
> attempt to massage away the problem.

The syntax for Pragma Import is:

         pragma Import(
             [Convention =>] convention_identifier, [Entity =>] local_name
          [, [External_Name =>] string_expression] [, [Link_Name =>] string_expression]);

It might be worth experimenting with using Link_Name instead of External_Name - this
should enable you to specify exactly what the link name generated by the Ada system is.

-- 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019