DEV Community

Discussion on: How to Use C Functions in Python

Collapse
 
markboer profile image
Mark Boer

There is quite a few ways to interface Python with C/C++. I hadn't heard of SIP before, but I think SWIG and Shiboken should be fairly similar in creating bindings automagically.

Personally I'm a big fan of Cython and pybind11. Cython was created to be able to transpile a python-like syntax to C to then compile it, but it can also be used to wrap C libraries or to interface with C code.

Pybind11 is similar to BoostPython as in that is was meant to expose C functionality to Python similar to what is being done in this article, but it also helps with converting types such as lists and tuples and makes it easier to manipulate the GIL.

If you are interested in this topic I have a talk on embedding Python into C++. Pretty much the exact opposite of this :P