Basically I want to make a Python program call functions written in C.
So (as far as I know) my options are:
- CTypes/CFFI
- Create a DLL/SO/DyLib containing the C functions and access them using CTypes or CFFI. Apparently CFFI is way faster with the only drawback of having to declare in python all the functions signatures.
- Pros:
- Don't have to make any adaptation in my C functions. All type-translation is done in Python.
- Cons:
- Performance ?
- Python Binary Module
- Write a python interface in C, converting my C module into a binary python module
- Pros:
- Performance ?
- Cons:
- All type-translation is done in C. Using [SIP][3] this might be automated.
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 ?