[C++-sig] Using symbols from other python extension modules?
Hans Meine
hans_meine at gmx.net
Thu Jul 30 19:43:15 CEST 2009
Hi,
when developing boost::python or SIP-based extension modules, we have
repeatedly had the need to use C++ classes or functions from other modules.
(E.g. I might have a foocmodule and a corresponding unit test module.)
A good use case is a boost::python-like registry (with a slightly different
purpose), which should be shared across multiple modules.
However, I have always been facing the problem that this seemed to require a
common shared library (à la libboost_python), but this is
a) overkill e.g. in the case of only a single required function
(get_registry()), and
b) not supported (AFAIK) by distutils/setuptools (i.e. building shared
libraries requires lengthy, possibly non-portable hacks).
It would be great if I could somehow tell the dynamic linker to resolve
against the function definition in the other module (and in fact it works at
least on Linux to link against libfoocmodule.so, but IIRC that's not
portable).
What are your recommendations/experiences?
Thanks,
Hans
More information about the Cplusplus-sig
mailing list