Reputation: 367
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 ?
Upvotes: 14
Views: 8044
Reputation: 7187
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.
Upvotes: 1