I have a poorly designed and big (> 300 public functions
, >200 numeric constants
defined with #define
in the header file) that I have to wrap in Python. I have the dll
and the h
file. The library is updated yearly, till now in a backwards compatible way (i.e. just functions were added, a constant keep their numerical values, etc). But I have no guarantees as I do not control the library.
Using ctypes
, I see two ways of wrapping this in Python:
- Mapping every constant and function to python, 1 to 1
- Redefining the API in Python and making calls to the library.
The first can be done in a (roughly) automatic way from the header file and therefore is easier to maintain and upgrade, the second requires a lot of python code but it will be easier to use.
I would appreciate some opinions based on your experience with this type of problem and some examples.