Basically I want to make a Python program call functions written in C.
So (as far as I know) my options are:
Convert the C module into a python binary module is really faster ?
Does both solutions support sending python callbacks to C functions ?
Is SIP a good option to generate a python interface ? Are there any other options ?
Are there any other particularities in any of them ?
CFFI is an external package providing a C Foreign Function Interface for Python. CFFI allows one to interact with almost any C code from Python.
I was just reviewing an old list of options I published related to this: http://stromberg.dnsalias.org/~strombrg/speeding-python/
If you're only targeting CPython (2.x or 3.x), I'd probably go for Cython.
If you want to be able to run on Pypy too, CFFI might be good; I've not tried it yet, but it sounds great. It's not entirely like ctypes though - ctypes is more ABI level, while CFFI is more API level - which is nice.
If you want to be able to run on Jython too, subprocess is probably your best bet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With