I have an internal API, written in C, which I'd like to write a Python wrapper around it. The API is well structured: it has a few data structs and functions for each kind of struct, like this:
struct XYZ;
MYAPI_XyzDoBuzz(XYZ* xyz, int other, int parameters);
MYAPI_XyzDoFizz(XYZ* xyz, int other, double funky, int parameters);
I was thinking into creating a myapi module and a class Xyz inside this module with methods like do_buzz and do_fizz. Each method would call it's corresponding function in the dynamic library, probably through ctypes (maybe the module keeping a global variable with the result from the ctypes.CDLL call).
Is my proposed structure a good way to expose this API to Python? Are there guidelines and best practices examples for wrapping C dlls for Python?
mathandtimeas examples.osis another one to read. – S.Lott Jul 6 '11 at 20:49