From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: interfacing with c object link gnatmake link problem
Date: Mon, 11 Nov 2019 00:39:31 +0200
Date: 2019-11-11T00:39:31+02:00 [thread overview]
Message-ID: <h2rht3FtofuU1@mid.individual.net> (raw)
In-Reply-To: <lyy2wncu0r.fsf@pushface.org>
On 2019-11-10 23:15, Simon Wright wrote:
> Alain De Vos <devosalain71@gmail.com> 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
. @ .
next prev parent reply other threads:[~2019-11-10 22:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-10 21:04 interfacing with c object link gnatmake link problem Alain De Vos
2019-11-10 21:15 ` Simon Wright
2019-11-10 22:39 ` Niklas Holsti [this message]
2019-11-11 14:17 ` Shark8
2019-11-11 15:32 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox