Reputation: 3682
What's the best way to call C++ function from shared object in python. Can I can solve this problem without additional python extension?
Upvotes: 1
Views: 488
Reputation: 3266
Another way is to use swig (http://www.swig.org/) to generate a python module wrapping the C++ code.
Upvotes: 1
Reputation: 2344
If you have the C++ source code, I would say boost python is the best way because it's very easy to get this up and running and it's flexible. If you don't have C++ source then checkout ctypes.
Upvotes: 2
Reputation: 4220
Perhaps you could investigate ctypes, although you will need to know things like the mangled name of the function and the correct calling convention.
If that doesn't work you'll need to create a C wrapper around the C++ code.
Upvotes: 3