What's the best way to call C++ function from shared object in python. Can I can solve this problem without additional python extension?
Asked
Active
Viewed 480 times
3 Answers
3
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.

Tom Whittock
- 4,081
- 19
- 24
2
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.

01100110
- 2,294
- 3
- 23
- 32
1
Another way is to use swig (http://www.swig.org/) to generate a python module wrapping the C++ code.

Chris Card
- 3,216
- 20
- 15