[C++-sig] linking with a ".a" file with boost.python

Rene Rivera grafik.list at redshift-software.com
Wed Jul 6 05:26:13 CEST 2005


Dirgesh Patel wrote:
> i also have a choice of linking with a ".a" file or a ".so" file...how can i
> link with those kinds of file in my Jamfile?
> 
> please advice

Ok those are easier to deal with... To link to "external" libraries, and 
by external I mean something not built within the Boost.Build tool, you 
need to tell Boost.Build two things: a) how to find the external 
library, and b) the name of the external library.

For (a) you can specify any number of paths to search for the library by 
adding "<library-path>/some/path" feature to the requirements section of 
the target. And what all those terms means is described here:

http://www.boost.org/tools/build/v1/build_system.htm#main_targets

Altering the example at: 
http://www.boost.org/tools/build/v1/example/lib_use/Jamfile slightly it 
could be like so:

exe simple
     :
         # SOURCES
         simple.cpp
     :
         # REQUIREMENTS
         <threading>multi
         <library-path>/usr/local
         <library-path>./.libs
     :
         # DEFAULT BUILDS
     ;

And to go along with that you also need to tell it (b) the name of the 
library to link to by adding a "<find-library>somelib" again to the 
requirements section. To continue the same example:

exe simple
     :
         # SOURCES
         simple.cpp
     :
         # REQUIREMENTS
         <threading>multi
         <library-path>/usr/local
         <library-path>./.libs
         <find-library>somelib
     :
         # DEFAULT BUILDS
     ;

In the above case the type of library, .a vs .so, is determined by the 
linker.

Alternatively you can do both (a) and (b) in one if you know the 
complete path to the library. In this case you can add a 
"<library-file>./.libs/libsomelib.so" instead:

exe simple
     :
         # SOURCES
         simple.cpp
     :
         # REQUIREMENTS
         <threading>multi
         <library-file>./.libs/libsomelib.so
     :
         # DEFAULT BUILDS
     ;

The complete set of features you can use are currently only documented 
in the source code at:

http://www.boost.org/tools/build/v1/features.jam

HTH.

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org




More information about the Cplusplus-sig mailing list