[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Writing a C extension - borrowed references

On Tue, Mar 20, 2018 at 5:36 PM, Rob Gaddi
<rgaddi at highlandtechnology.invalid> wrote:
> If all you're doing is a thin-wrapper around a C library, have you thought
> about just using ctypes?

Yep; the C library whose API I'm using uses macros to cast things to
the right structure, and (similar to Cython), as I already _have_ the
code, I wasn't particularly interested in working out how to convert
things like:


into ctypes compatible syntax, when I can simply adapt the working C
code to Python. :)

Plus, there is the library static initialisation to manage, the issues
of distributing the C libraries if I do a C wrapper to call from
ctypes. This way, it can be distributed from our devpi very easily.