[Pyrex] referencing the module object (__pyx_m aka module_cname)?
Yann Vernier
yann at donkey.dyndns.org
Fri Nov 5 23:45:36 CET 2004
I'm trying to replace a C/Python module called "Text", which is
statically linked and initialized by a function called Text_Init.
So far that's pretty simple, but the function needs to return the newly
created Module Object. I found it in the generated C code, it's called
__pyx_m, but I can't seem to access it properly.
This part works, but the "module" name needs a working declaration:
# initText is the initializer for dynamic loading
cdef public void initText() except *
# Text_Init is called when this is linked statically
cdef public object Text_Init():
initText()
return module
I've tried a few combinations:
cdef extern object __pyx_m
No go, Pyrex says Python Objects can't be extern.
cdef object __pyx_m
This causes a duplicate declaration, which is fine, and an
initialization to None which is not. Segfault due to that
overlapping initialization.
cdef public object __pyx_m
This uses some DL_EXPORT magic, and there will be colliding symbols
from other modules in that case. Also initalizes as above.
How can this be done?
--
PGP fingerprint = 9242 DC15 2502 FEAB E15F 84C6 D538 EC09 5380 5746
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20041105/2c2ff8bc/attachment.bin
More information about the Pyrex
mailing list