comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex R. Mosteo" <alejandro@mosteo.invalid>
Subject: Re: Problem referencing library file via project file
Date: Sat, 30 Apr 2011 23:36:18 +0200
Date: 2011-04-30T23:36:18+02:00	[thread overview]
Message-ID: <iphvck$dkn$1@dont-email.me> (raw)
In-Reply-To: avg5n91tudn2.1omhe5aj82v7j.dlg@40tude.net

Dmitry A. Kazakov wrote:

> On Sat, 30 Apr 2011 09:15:34 +0100, Robert Matthews wrote:
> 
>> I am trying to link the webkit library file with my program.
>> One way that works is to use:
>> 
>> pragma Linker_Options ("-lwebkit-1.0");
>> 
>> in my source file.
>> 
>> However I would like to specify this in the program's
>> project file. I have tried:
>> 
>> package Linker is
>>    for Default_Switches ("ada") use ("-lwebkit-1.0");
>> end Linker;
>> 
>> but this seems to be ignored - I just get undefined
>> reference messages from gnatlink. Please help!
> 
> I would recommend always refer external non-Ada libraries as proper
> library projects rather than a bunch of linker options.
> 
> In your case it could be:
> 
> webkit.gpr:
> ---------------------------------------------------
> project WebKit is
>    for Externally_Built use "true";
>    for Source_Files use ();
>    for Library_Dir use "/usr/lib"; -- Or whatever location it has
>    for Library_Name use "webkit-1.0";
>    for Library_Kind use "dynamic";
> end WebKit;
> -------------------------------------------------
> and then in your project you just "with" it:
> 
> with "webkit.gpr";
> 
> Gprbuild and gprmake would do the rest.

Thanks, that's a nice and clean solution. My experiences with 
Linker'Linker_Options and Linker'Switches have shown some inconsistencies 
over time that I didn't know how to solve in an elegant way, which I guess 
this will do.

Alex.

> 
> P.S. I would make this packaging policy for all Ada distributions.
> 




      parent reply	other threads:[~2011-04-30 21:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-30  8:15 Problem referencing library file via project file Robert Matthews
2011-04-30  8:34 ` Dmitry A. Kazakov
2011-04-30  8:57   ` Robert Matthews
2011-04-30 21:36   ` Alex R. Mosteo [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox