On 3 March 2010 20:28, Ondrej Certik <[email protected]> wrote: >> >> Cython could grow support for your use case... If you really feel you >> will need this (as opposed to implementing the "Python" class), >> perhaps I could take a look at it and implement something... > > Do you have some ideas how Cython could be improved to make my use case > easier? >
The easier way to get something working would be to use a preprocessor macro to control the storage (i.e. static vs. extern) of the symbols you get in the generated C header... Then you just have to #include the module API header like this: #define CYTHON_USE_GLOBAL_API #include <mymodule_api.h> You will still need to call import_mymodule(), but you just need to do it earlier in your code, likely a few lines below Py_Initialize() Does this look good/easy enough for you? > I can try to write something too --- I am still in the stage of > figuring things out, not sure yet what I really want in details. I > only know my general goal --- it should be easy for C++ users to use > it, should be robust (no segfaults) and Python internals should not be > visible at all. I am half way there already. > I have to insist: The best (though admittedly complex) way to do this is you have a 'Python' class, in such a way its instances serve as a execution context... If you start with this, using separate interpreters (like Apache's mod_python) in the near future could be straightforward. -- Lisandro Dalcin --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
