[C++-sig] When not to use static boost python library
Mr Kun Hong
kun.hong at uqconnect.edu.au
Wed May 12 04:05:30 CEST 2010
I am new to boost python. I have some experience making python extension using pure C.
Now I have a question: when should I not use static boost python library?
I tried to search the archive a bit. But haven't found a good answer. I read the boost python
library documentation, where the section 6.2 mentioned when should should static binary.
But I still not very clear about it. The lines in the documentation is:
It might be appropriate to use the static Boost.Python library in any of the following cases:
* You are extending python and the types exposed in your dynamically-loaded extension module
don't need to be used by any other Boost.Python extension modules, and you don't care if the
core library code is duplicated among them.
* You are embedding python in your application and either:
* You are targeting a Unix variant OS other than MacOS or AIX, where the
dynamically-loaded extension modules can “see” the Boost.Python library
symbols that are part of the executable.
* Or, you have statically linked some Boost.Python extension modules into
your application and you don't care if any dynamically-loaded
Boost.Python extension modules are able to use the types exposed by your
statically-linked extension modules (and vice-versa).
First of all, I am not embedding python interpreter in my app. I want to write an
extention that can by loaded dynamicaly. So I fall into the first case, and I don't
care my core library code is duplicated (i think here it means the boost python code
is duplicated). But I do care the types and functions in my produced extension can
be used. I have built my extension using static boost python lib and test it by writing
some python code access the typs and functions exposed. It all works fine. So I guess
what the problem is should be that: another python extension, written in boost python,
cannot access the types and functions exposed in my current extension. I am not
clear why is it so, becaused it is exposed to the python interpreter already. If there are
two python extensions, both written in pure C, can't they access each other's type and
Thanks in advance for any help.
More information about the Cplusplus-sig