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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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!news2.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!newsfeed.straub-nv.de!noris.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Linking with GNAT on Windows Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <0ac0e003-176f-48d1-b72f-56f81dae922e@1g2000vbm.googlegroups.com> Date: Tue, 24 Nov 2009 18:34:43 +0100 Message-ID: <69epr50o3g3w$.108hd37jl3fjj$.dlg@40tude.net> NNTP-Posting-Date: 24 Nov 2009 18:34:40 CET NNTP-Posting-Host: 37b9f145.newsspool1.arcor-online.net X-Trace: DXC=[RCk^62Vcc3T2Rfi64Fo<]lROoR1<`=YMgDjhg2;@6ZATG6]e6[6LHn;2LCV>[ On Tue, 24 Nov 2009 08:26:00 -0800 (PST), Maciej Sobczak wrote: > Imagine a C library compiled with Visual Studio. This library is used > by an Ada program by means of pragma Import. > > When the C library is compiled in the Debug mode, GNAT can link the > whole program. If the same C library is compiled in the Release mode, > the GNAT linker says "undefined reference" with regard to the C > function that is imported by Ada. Hmm, it is no matter how the program is compiled, but how is it linked. Debug/Release are just project scenario names, which can mean anything in the concrete project. Of course we cannot exclude that some inspired C programmer could make use of #ifdef __DEBUG__ to change names of all functions in the source... AFAIK, GNAT does not recognize the MS lib files, so you have to convert them into *.a with the corresponding mangling of names especially if that is C++ and not export "C" stuff. There is also exist *.def files which may influence the names of the entries in the import library. Further there exist __declspec(dllexport), __cdecl, __stdcall modifiers in the program, which might have effect on the external names. Plus in Visual Studio there can be defined post build steps. which might call scripts and do, well, anything. All in one, it is impossible to say what is going on. You have to verify all steps. I would ensure that *.a file is created and used by GNAT. Then I would check the names in it (nm -s). Then I would verify the content of its source *.lib file etc. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de