[Pyrex] A "main" function for Pyrex

Michael Sparks zathras at thwackety.com
Sat Oct 2 20:37:01 CEST 2004


On Fri, 1 Oct 2004, Lenard Lindstrom wrote:
...
> All that is needed is for the C macro __pymoduleinit__ to be defined
> as the name of the python module init function (initembedded in the
> above example). This can be done with an argument to the compiler. Or an
> addition to the Pyrex compiler can put the macro definition at the
> beginning of the generated C file.
>
> Use pyrexc.py to compile the .pyx file. Compile the resulting C file
> like any other Python embedded program. I hope this is of some use.

Nice! :)

For the mailling list archive, one example command line that compiles this
is:
   gcc -O2 -I/usr/include/python embedded.c -o embedded -lpython2.3 -D__pymoduleinit__=initembedded

Regards,


Michael.





More information about the Pyrex mailing list