THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/09/2011 at 08:11, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ; PYTHON ;
---------
Hallo,
i wrote some c++ plugins for C4D V11.5, which embed python modules. Now i want to upgrade to V13 and none of my python-using plugins work anymore. My guess is, that it has to do with the C4D API embedding python itself and so interfering with my code.
Usually my PluginStart() method crashes instantly when PyImport_ImportModule() is called.
Bool PluginStart(void)
{
Py_Finalize();
if (Py_IsInitialized() != 0)
{
// import python module
PyObject *pyObj = PyImport_ImportModule("some.module.name");
// use the module
// ...
Py_Finalize();
}
return TRUE;
}
I started looking around in the API and found the file "lib_py.h" which defines classes for using python. I messed around with some of its functionality and i would love to use it, but without a proper documentation it's not possible
So here comes my question: Is there any documentation for those classes? I didn't find anything in the current SDK docs.
If not, could someone give my a hint what i can do to fix my code and make it work again?
Edit:
Looks like i have to aquire a GIL to make it work, but this will take some time for to understand the mechanisms. Maybe some can give me a brief introduction?