[C++-sig] Embedded Python plus module loading

Daniel Holth dholth at fastmail.fm
Mon Mar 21 05:21:40 CET 2005


On Sun, 2005-03-20 at 17:20 -0500, Daniel Holth wrote:

> My Jamfile:
> 
> project-root ;
> 
> # Include definitions needed for Python modules
> SEARCH on python.jam = $(BOOST_BUILD_PATH) ;
> import python ;
> 
> # The boost-jam embedding example
> exe embedding
> ~        : # sources
> ~        embedding.cpp
> ~        : # requirements
> ~        <threading>multi
> ~        <find-library>boost_python
> ~        $(PYTHON_PROPERTIES)
> ~        <library-path>$(PYTHON_LIB_PATH)
> ~        <find-library>$(PYTHON_EMBEDDED_LIBRARY)
> ~        ;
> 
> 
> I'm not sure where I'm going wrong and I'd appreciate some advice.
> Embedded Python is more useful when you can load dso's.

I've figured it out, more or less. When I link to libpython2.3.so rather
than the static Python library it works fine. Doesn't answer the
question of why my other program suddenly stopped working re: importing,
but it does fix it.

# The boost-jam embedding example
exe embedding
        : # sources
        embedding.cpp
        : # requirements
        <threading>multi        # my system's Python library is threaded
        <find-library>python2.3
        <find-library>boost_python
        ;

which imports sha without incident. Except it doesn't set the include
path, so the same jamfile won't both compile my code and link it. So now
I just have to work out the arguments to get it to link with the shared
library and set the include path properly... perplexing.

Thanks for any advice,

Daniel Holth
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20050320/341ba4e9/attachment.pgp>


More information about the Cplusplus-sig mailing list