I have two questions: 1) I want to call a C library from a Python application. I don't want to wrap the whole API, I want only the functions and datatypes that are relevant to my purpose.
As I see it, I have two choices:
- Use Cython to expose the relevant parts from the C library to Python.
- Do the whole thing in Python, using ctypes to communicate with the external library.
I'm not sure whether 1) or 2) is the better choice.
We may have some changes in the function prototypes or need to support few more functions over time.So,I thought using cython or some other tool might be better.
Are there more advantages / disadvantages with either choice? Which approach do you recommend?
2).Also I am newbie to Python and cython. If possible can somebody give some example on how to call c library from python app? I browsed over net, but could not get any example working. I might be missing some thing.
Any help will be really appreciated.