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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.N5M2DXr2fJIsm61cKlUWUQ.user.gioia.aioe.org!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: interfacing with c object link gnatmake link problem Date: Mon, 11 Nov 2019 15:32:35 +0000 Organization: Aioe.org NNTP Server Message-ID: References: <7ff91b06-4667-4fa4-8abf-6d172b033557@googlegroups.com> NNTP-Posting-Host: N5M2DXr2fJIsm61cKlUWUQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:SurB+RFqIcZY60gBTrCZA/5yhl8= Xref: reader01.eternal-september.org comp.lang.ada:57547 Date: 2019-11-11T15:32:35+00:00 List-Id: Niklas Holsti writes: > On 2019-11-10 23:15, Simon Wright wrote: >> Alain De Vos writes: >> >>> I try to interface to a c library. [...] >> % gnatmake mytest.adb -largs maaltwee.o >> >> (-largs is followed by arguments to be passed to the linker) > > My habit is to add > > pragma Linker_Options ("mylibrary.o"); > > to the Ada source file that imports the C functions. Then there is no > need to add options to the gnatmake command. When it's not a small demo/test program, my habit is to write a gprbuild project file. Or maybe a makefile. It won't worry me, but what if the object file turns out to be mylibrary.obj? Much easier to change these sorts of OS-dependent things outside Ada.