comp.lang.ada
 help / color / mirror / Atom feed
* Problem referencing library file via project file
@ 2011-04-30  8:15 Robert Matthews
  2011-04-30  8:34 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Matthews @ 2011-04-30  8:15 UTC (permalink / raw)


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!

Robert Matthews



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem referencing library file via project file
  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
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry A. Kazakov @ 2011-04-30  8:34 UTC (permalink / raw)


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.

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

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem referencing library file via project file
  2011-04-30  8:34 ` Dmitry A. Kazakov
@ 2011-04-30  8:57   ` Robert Matthews
  2011-04-30 21:36   ` Alex R. Mosteo
  1 sibling, 0 replies; 4+ messages in thread
From: Robert Matthews @ 2011-04-30  8:57 UTC (permalink / raw)


Dmitry A. Kazakov wrote:
> 
> 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.
> 
> P.S. I would make this packaging policy for all Ada distributions.
> 

That did it! Many thanks.

Robert Matthews




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem referencing library file via project file
  2011-04-30  8:34 ` Dmitry A. Kazakov
  2011-04-30  8:57   ` Robert Matthews
@ 2011-04-30 21:36   ` Alex R. Mosteo
  1 sibling, 0 replies; 4+ messages in thread
From: Alex R. Mosteo @ 2011-04-30 21:36 UTC (permalink / raw)


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.
> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-30 21:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox