martes, agosto 04, 2009

Compiling Python C extensions using gcc



Just a quick reminder. To manually compile a Python C extension on Linux using gcc and without distutils the magic command is:
gcc --shared -fPIC $(python-config --cflags) $(python-config --ldflags) base85.c -o base85.so

Then, to test the new extension:
$ PYTHONPATH=. python
Python 2.5.2 (r252:60911, Jan 4 2009, 21:59:32)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import base85
>>> base85
<module 'base85' from 'base85.so'>

No hay comentarios.: