<div dir="ltr">Hello,<br>I&#39;m using boost::python and I&#39;ve got a problem now.<br><br>&nbsp;I&#39;m writing a shared library(bundle, I&#39;m using MacOSX10.5, and it&#39;s a plug-in for some<br>application) where I have a code like this.<br>
<br>&nbsp;&nbsp;&nbsp; //....on init....<br>&nbsp;&nbsp;&nbsp; if ( ! Py_IsInitialized())<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int a = PyImport_AppendInittab(&quot;MyModule&quot;, &amp;initMyModule);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Py_Initialize();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PyEval_InitThreads();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PyEval_ReleaseLock();<br>
&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; //....somewhere else...<br>&nbsp;&nbsp;&nbsp; PyGILState_STATE state = PyGILState_Ensure();<br>&nbsp;&nbsp;&nbsp; module = object(handle&lt;&gt;(PyModule_New(moduleName)));<br>&nbsp;&nbsp;&nbsp; myMod = object(handle&lt;&gt;(PyImport_ImportModule(&quot;MyModule&quot;)));<br>
&nbsp;&nbsp;&nbsp; module.attr(&quot;mymod&quot;) = myMod;<br>&nbsp;&nbsp;&nbsp; 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(&quot;MyModule&quot;) 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&#39;m really puzzled.<br><br><br>I would really appreciate if anybody could help.<br><br>-Koichi<br><br></div>