comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Linking with GNAT on Windows
Date: Wed, 25 Nov 2009 10:46:56 +0100
Date: 2009-11-25T10:46:56+01:00	[thread overview]
Message-ID: <1tz8hsohppx0j.1sqxhytef0t79.dlg@40tude.net> (raw)
In-Reply-To: 3ade5d53-eedd-4a0e-bf4f-bbf6a62cf997@c3g2000yqd.googlegroups.com

On Wed, 25 Nov 2009 00:43:11 -0800 (PST), Maciej Sobczak wrote:

> On 24 Lis, 18:34, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
> 
>> Hmm, it is no matter how the program is compiled, but how is it linked.
> 
> The GNAT invocation is the same in both cases and includes this:
> 
> -largs -lmylibrary

Usually debug/release versions have different names like mylibraryd.lib or
else placed into different subdirectory like .\Debug vs. .\Release. What
about the "-L" switch?
 
> with mylibrary.lib (the result of compilation on Visual Studio) file
> somewhere around.
> 
>> Of course we cannot exclude that some inspired C programmer
> 
> I was that programmer. The whole C library amounts to a single
> function with single line of code ("Hello from C", essentially), no
> preprocessor and no other tricks. The function is declared as extern
> "C" to avoid name mangling.

OK, extern "C" normally mangles, e.g. adds underscore in front of the name.
Also, if I correctly remember, stdcall convention adds some funny suffixes
like "@4" to the names in import libraries. But that behavior is
independent on debug/release.

I think you should:

1. Remove all instances of mylibrary.lib.
2. Build it anew.
3. Ensure that GNAT links the library you have built.
4. If error persists, view the lib file. Compare names there and the
unresolved references reported by GNAT.

(There exist plug-ins for Window commander to list the entry points of a
library.)

>> AFAIK, GNAT does not recognize the MS lib files,
> 
> It seems to recognize them.

Yes, you are right. I forgot that.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2009-11-25  9:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-24 16:26 Linking with GNAT on Windows Maciej Sobczak
2009-11-24 17:34 ` Dmitry A. Kazakov
2009-11-24 18:03   ` Pascal Obry
2009-11-25  1:36     ` Kevin K
2009-11-25  8:43   ` Maciej Sobczak
2009-11-25  9:46     ` Dmitry A. Kazakov [this message]
2009-11-25 12:47       ` Maciej Sobczak
2009-11-25 13:44         ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox