Just completed writing my first ever C-based Python extension. MUUUUUCH better experience than writing the same exact extension, but for PHP. Like, I'm in wholly different universe.
Conversation
Replying to
CFFI is the easiest and nicest way to interface with C from Python. Strongly recommend that over CPython extensions unless you have special requirements like needing to do work without the CPython GIL held. It's probably a bad choice of language when that's relevant though.
1
Replying to
How well does CFFI work with ABIs that use linked lists provided by queue(3)?
Directly related example here:
1
Replying to
It fully understands C89 macros so that should all work fine without even needing any wrapper code.
You can easily make C wrapper code without needing to deal with building it, etc. yourself but you usually don't need to do that.
1
1
CFFI is similar to the ctypes module for simple cases but it has a lot of conveniences and what makes it a lot different is that it understands a large subset of C to make the bindings for you. You just write a bit of Python code. Usually don't need to actually write any C code.
Replying to
I think after I've hit a few crucial milestones at ${DAYJOB}, I'll revisit CFFI. Since the module's already written at this point, there's not much need to redo the work.
Thanks for the suggestion! I'll take a deeper look into CFFI for our next modules.
1

