<div dir="ltr">Hello,<br>I'm using boost::python and I've got a problem now.<br><br> I'm writing a shared library(bundle, I'm using MacOSX10.5, and it's a plug-in for some<br>application) where I have a code like this.<br>
<br> //....on init....<br> if ( ! Py_IsInitialized())<br> {<br> int a = PyImport_AppendInittab("MyModule", &initMyModule);<br> Py_Initialize();<br> PyEval_InitThreads();<br> PyEval_ReleaseLock();<br>
}<br><br> //....somewhere else...<br> PyGILState_STATE state = PyGILState_Ensure();<br> module = object(handle<>(PyModule_New(moduleName)));<br> myMod = object(handle<>(PyImport_ImportModule("MyModule")));<br>
module.attr("mymod") = myMod;<br> PyGILState_Release(state);<br><br>I statically linked boost::python, and it works fine. When imported, MyModule is<br>filled with classes that boost::python has wrapped.<br>
<br>But when I use another shared library(#) which dynamically links boost::python<br>together with mine, PyImport_ImportModule("MyModule") returns a module which dict<br>is empty but __doc__ and __name__.<br><br>
Instead of (#) I made a test shared library that does nothing but linking<br>boost::python dynamically, and it still fails.<br><br>Why does all statically linked boost::python and extension is affected by a dynamically<br>
linked boost::python? I'm really puzzled.<br><br><br>I would really appreciate if anybody could help.<br><br>-Koichi<br><br></div>