[C++-sig] basic embedded boost.python build question

David Abrahams dave at boost-consulting.com
Thu Jun 30 14:01:45 CEST 2005


Nathan Tuck <ntuck at ssoc-inc.com> writes:

> I have a somewhat basic build question for embedded python, but I have
> not been able to google the answer.
>
> First of all, I am using Linux.
>
> I want to build an application with an embedded (dynamically linked)
> python interpreter and a module of statically linked (into the
> application executable) boost.python routines.  I would prefer not to
> compile separate .so's for the modules or include my own custom version
> of the interpreter.
>
> Is it possible to make this work?  The best solution I have come up with
> so far has three pieces: 1) an executable 2) the boost module .so 

I assume you mean the Boost.Python shared library here.

> and 3)
> another .so implementing the functions that are called both by the boost
> module and the executable.  Surely there is a way I can get this down to
> one file (just the executable) which dynamically links to the main
> python libs?

There's a Boost.Python static library that you can use instead of the
Boost.Python shared library.  The "functions that are called both by
the boost module and the executable" can just be linked statically
into your application.  In fact, the "embedding" target in
libs/python/test/Jamfile shows how to build exactly that
configuration.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list