Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Switch from ctypes to cffi for calling the c code #99
This issue tracks (and is open for any comments) a potential "upgrade" from ctypes to CFFI. CFFI have a number of advantages but also a downsides.
Advantages (compared to ctypes):
Disadvatages (compared to ctypes):
For me I see the 1st advantage as the main point. I have had great difficulties with strange segfaults with 64bit pythons on windows, and also sometimes on 32bit python, and support for 64bit python on both windows and linux is something I really want. Hopefully those problems will be easier to handle with CFFI since it has an active community.
Then comes the 3rd advantage, that its a bit easier to wrap the c code. For ctypes I have a automatic wrapping script that does most of the low level wrapping, but its not supported, very difficult to set up (I only managed inside a VM with linux) and quite annoying. CFFI would be a clear improvement.
For the disadvantage of ctypes I think it will be acceptable, even if not ideal. Many python packages have to be installed in some way (like pygame), and nowadays with pip its very easy to do. So I hope that it will be ok.
Current work on CFFI can be tracked in the cffi branch https://github.com/viblo/pymunk/tree/cffi
Feel free to post any thoughts or comments on this issue!