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.2 required=5.0 tests=BAYES_00,URI_TRY_3LD autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: interfacing with c object link gnatmake link problem Date: Mon, 11 Nov 2019 00:39:31 +0200 Organization: Tidorum Ltd Message-ID: References: <7ff91b06-4667-4fa4-8abf-6d172b033557@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net lRopyjEpqpSok4jnFxy8ag+fjrVITjyxrX9NKYvLPuvMP3esIP Cancel-Lock: sha1:s+mxNF+6YCKBsAQMfTyjx4/eusI= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:57544 Date: 2019-11-11T00:39:31+02:00 List-Id: On 2019-11-10 23:15, Simon Wright wrote: > Alain De Vos writes: > >> I try to interface to a c library. >> The docs, >> https://learn.adacore.com/courses/intro-to-ada/chapters/interfacing_with_c.html >> >> How to inform gnatmake that it should link to mylibrary.o ? >> >> I solve it currently by calling gnatlink explicitly after running gnatmake , >> but maybe there is a nicer solution. >> % gnatlink mytest.ali ./maaltwee.o > > % 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. -- Niklas Holsti niklas holsti tidorum fi . @ .