Hacker News new | ask | show | jobs
by UK-AL 5069 days ago
Not always. See boost python.
1 comments

I'm aware of that. But it's essentially a shim layer, albeit one that is semi-automatically generated. The preferred way of doing Python FFI is to use ctypes inside Python, not write (or generate) C or C++ code that works as the shim.

That's the way many languages prefer to do their FFI, write "foreign" declarations in the language itself, not in C++ land. E.g. in Haskell, you can call C with very little effort. When dealing with C++ you have to get along with ABI issues and things get a lot harder.