[C++-sig] static/dynamic boost::python conflicts?
Koichi Tamura
hohehohe2 at gmail.com
Wed Jul 23 12:04:43 CEST 2008
Hello,
I'm using boost::python and I've got a problem now.
I'm writing a shared library(bundle, I'm using MacOSX10.5, and it's a
plug-in for some
application) where I have a code like this.
//....on init....
if ( ! Py_IsInitialized())
{
int a = PyImport_AppendInittab("MyModule", &initMyModule);
Py_Initialize();
PyEval_InitThreads();
PyEval_ReleaseLock();
}
//....somewhere else...
PyGILState_STATE state = PyGILState_Ensure();
module = object(handle<>(PyModule_New(moduleName)));
myMod = object(handle<>(PyImport_ImportModule("MyModule")));
module.attr("mymod") = myMod;
PyGILState_Release(state);
I statically linked boost::python, and it works fine. When imported,
MyModule is
filled with classes that boost::python has wrapped.
But when I use another shared library(#) which dynamically links
boost::python
together with mine, PyImport_ImportModule("MyModule") returns a module which
dict
is empty but __doc__ and __name__.
Instead of (#) I made a test shared library that does nothing but linking
boost::python dynamically, and it still fails.
Why does all statically linked boost::python and extension is affected by a
dynamically
linked boost::python? I'm really puzzled.
I would really appreciate if anybody could help.
-Koichi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080723/c6ec5c44/attachment.htm>
More information about the Cplusplus-sig
mailing list