[Pyrex] referencing the module object (__pyx_m aka module_cname)?
Phillip J. Eby
pje at telecommunity.com
Sun Nov 7 19:53:31 CET 2004
At 09:52 AM 11/7/04 +0100, Yann Vernier wrote:
>On Sat, Nov 06, 2004 at 09:26:13PM -0500, Phillip J. Eby wrote:
> > At 01:00 AM 11/7/04 +0100, Yann Vernier wrote:
> > >cdef extern from *: # These are declared "elsewhere"; actually, in
> > >Pyrex.
> > > void *module "__pyx_m"
> >
> > Why can't you just use 'import' to get the module object? Wouldn't
> that be
> > simpler than all this stuff?
>
>Maybe. I am not sure how that would look, and I do not want it in the
>Python namespace, only to return it in a C function. The module is
>embedded into Blender and available there as Blender.Text, but I am not
>sure if it is visible at all during init time.
cdef public object Text_Init():
...
import Blender.Text as retval
return retval
or, if Pyrex doesn't allow the above:
cdef extern from "Python.h":
object PyImport_ImportModule(char *name)
cdef public object Text_Init():
...
return PyImport_ImportModule("Blender.Text")
More information about the Pyrex
mailing list