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)<br><br><br>Cheers,<br><br>- Pete<br><br><div><span class="gmail_quote">
On 18/03/07, <b class="gmail_sendername">Christian Heimes</b> <<a href="mailto:lists@cheimes.de">lists@cheimes.de</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Peter Waller schrieb:<br>> Or even better, can I just embed plain C code in my pyrex?<br><br>You can split your extension in a C file and pyrex file. It's very easy<br>with pyrex and distutils. :]<br><br>For example I've written an optimized C version of my crypttea module
<br>that implements the algorithms in C. I've a ctea.c and ctea.h file which<br>contain the C code for the decryption and encryption functions. The<br>_pyxtea.pyx file is the glue code between the C functions and Python.
<br><br>My setup.py file looks like:<br><br>from setuptools import setup<br>from setuptools import Extension<br><br>cxtea = Extension('crypttea._pyxtea',<br> ['src/crypttea/_pyxtea.pyx', 'src/crypttea/ctea.c']
<br> )<br><br>setup(...<br> ext_modules=[cxtea],<br> )<br><br>HTH<br>Christian<br><br><br>_______________________________________________<br>Pyrex mailing list<br><a href="mailto:Pyrex@lists.copyleft.no">Pyrex@lists.copyleft.no
</a><br><a href="http://lists.copyleft.no/mailman/listinfo/pyrex">http://lists.copyleft.no/mailman/listinfo/pyrex</a><br></blockquote></div><br>