[Pyrex] Function decorations

Peter Waller peter.waller at gmail.com
Sun Mar 18 13:54:34 UTC 2007


My current method is to write the code in a .h and include it, which I'm
pretty happy with, but I was wondering if there was a 'better way' (TM)


Cheers,

- Pete

On 18/03/07, Christian Heimes <lists at cheimes.de> wrote:
>
> Peter Waller schrieb:
> > Or even better, can I just embed plain C code in my pyrex?
>
> You can split your extension in a C file and pyrex file. It's very easy
> with pyrex and distutils. :]
>
> For example I've written an optimized C version of my crypttea module
> that implements the algorithms in C. I've a ctea.c and ctea.h file which
> contain the C code for the decryption and encryption functions. The
> _pyxtea.pyx file is the glue code between the C functions and Python.
>
> My setup.py file looks like:
>
> from setuptools import setup
> from setuptools import Extension
>
> cxtea = Extension('crypttea._pyxtea',
>     ['src/crypttea/_pyxtea.pyx', 'src/crypttea/ctea.c']
>     )
>
> setup(...
>      ext_modules=[cxtea],
>      )
>
> HTH
> Christian
>
>
> _______________________________________________
> Pyrex mailing list
> Pyrex at lists.copyleft.no
> http://lists.copyleft.no/mailman/listinfo/pyrex
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.copyleft.no/pipermail/pyrex/attachments/20070318/d7a543c2/attachment.html 


More information about the Pyrex mailing list