There are several ways to wrap C in Python, and I don't know which one to use, so I've summarized them. However, I can't guarantee that it's correct because I didn't actually try it just by checking it. There seems to be other methods with cpp.
Python/C API --Advantages --Can be completed with CPython only --Often used
--Disadvantages --Needs a deep understanding of Python, C, and the Python / C API --Since it is written like C, the amount of code increases
SWIG --Advantages --Automatically wraps
--Disadvantages --Complex code cannot be wrapped automatically
SIP --Advantages --Unknown
--Disadvantages --There is almost no information in Japanese
Boost.Python --Advantages --Automatically wraps
--Disadvantages --You need to mess with the code on the c side
ctypes --Advantages --Automatically wraps --A standard feature of Python
--Disadvantages --Complex code cannot be wrapped automatically
cffi --Advantages --Automatically wraps
--Disadvantages ――When it gets complicated, it cannot be wrapped automatically --There is not much information in Japanese
Cython --Advantages --Faster than other wrap tools --Easy to improve and simplify the interface
--Disadvantages --It doesn't wrap automatically
Cython looks good
Recommended Posts