On 10 May 2012 13:37, Mateusz Loskot email@example.com wrote:
On 10 May 2012 13:00, Stefan Behnel firstname.lastname@example.org wrote:
Mateusz Loskot, 10.05.2012 13:47:
Now, I'd like to add some types which are generated in run-time, way before the 'emb' module is appended to inittab and embedded Python is initialised.
Why would you want to do that before initialising the Python runtime?
The 'emb' must be added to inittab before Python is initialised (that's what the manual says, isn't it.) So, the scheme is this:
/* 1. Dynamically generate emb.GeneratedNoddy */ ... /* Trying to figure out how */
/* 2. Register 'emb' module as built-in */ PyImport_AppendInittab("emb", &PyInit_emb);
/* 3. Initialise Python */ Py_Initialize();
/* 4. we're ready to use */ ...
/* 5. Clean-up */ Py_Finalize();
Does it make sense?
I recall the explanation above. It is not necessary to place extension types construction before the PyImport_AppendInittab and Py_Initialize, of course.
Mateusz Loskot, http://mateusz.loskot.net