[Cython] new FFI library for Python

Stefan Behnel stefan_ml at behnel.de
Mon Jun 18 21:46:37 CEST 2012


Stefan Behnel, 18.06.2012 16:12:
> the PyPy folks have come up with a new FFI library (called cffi) for
> CPython (and eventually PyPy, obviously).
> 
> http://cffi.readthedocs.org/
> 
> It borrows from LuaJIT's FFI in that it parses C declarations at runtime.
> It then builds a C extension to access the external code, i.e. it requires
> a C compiler at runtime (when running in CPython).
> 
> Just thought this might be interesting.

The code is here, BTW:

https://bitbucket.org/cffi/cffi/

One interesting feature is that they seem to support different backends.
There's apparently one for libffi and one for ctypes so far. Another one
based on Cython would be cool. Even the existing ffi backend implementation
would have looked better in Cython, it's currently some 3000 lines of C
code. And Cython could certainly benefit from an ffi backend itself for a
couple of tasks, this topic has come up before a couple of times.

Stefan


More information about the cython-devel mailing list