From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,90504b78c9e015b1 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!c3g2000yqd.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Linking with GNAT on Windows Date: Wed, 25 Nov 2009 00:43:11 -0800 (PST) Organization: http://groups.google.com Message-ID: <3ade5d53-eedd-4a0e-bf4f-bbf6a62cf997@c3g2000yqd.googlegroups.com> References: <0ac0e003-176f-48d1-b72f-56f81dae922e@1g2000vbm.googlegroups.com> <69epr50o3g3w$.108hd37jl3fjj$.dlg@40tude.net> NNTP-Posting-Host: 137.138.182.236 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1259138592 28810 127.0.0.1 (25 Nov 2009 08:43:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 25 Nov 2009 08:43:12 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: c3g2000yqd.googlegroups.com; posting-host=137.138.182.236; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8230 Date: 2009-11-25T00:43:11-08:00 List-Id: On 24 Lis, 18:34, "Dmitry A. Kazakov" 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 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. > AFAIK, GNAT does not recognize the MS lib files, It seems to recognize them. Not only it complains when the file is not around (note: it can automatically make an association between - lmylibrary linker option and the mylibrary.lib file - this would not be the case if .lib files were not supported at all), but it really works fine if the C library is build in the Debug mode. I have tried to analyze all options in these two modes, but do not see any differences that would affect this. > There is also exist *.def files which may influence the names of the > entries in the import library. Yes, but this is not used. My naive first diagnostics was that the library compiled in Debug mode has its names exported by default, whereas the Release mode would need the .def file. This theory is contradicted by the fact that a test C program can use that library no matter how it was compiled. But then, it is the single toolchain on the whole path. > Further there exist __declspec(dllexport), __cdecl, __stdcall modifiers in > the program, which might have effect on the external names. None of these are used. Note that it is a static library, not a DLL. > Plus in Visual Studio there can be defined post build steps. These are not defined. The C library was created as a pristine project. > All in one, it is impossible to say what is going on. Cool. I am pretty convinced that this is not even a GNAT issue, but rather concerns the interaction of Visual Studio and MinGW toolchain that is a backend for GNAT. -- Maciej Sobczak * www.msobczak.com * www.inspirel.com Database Access Library for Ada: www.inspirel.com/soci-ada