Boost.Python is really a very powerful library, but if you are working with code written in plain “C” - you’ve got a problem. You have to create wrappers for almost every function or variable.
The idea behind “ctypes integration” functionality is really simple: you configure Py++ to expose address of the variable\return value, and than you you use ctypes from_address functionality to access and modify the data.
Obviously, this approach has pros and cons:
- cons - it could be very dangerous - you can corrupt your application memory
- cons - managing memory is not something a typical Python user get used to. It is too “low level”.
- pros - you don’t need to create wrapper in C++
- pros - a Python user has access to the data
- pros - compilation time is smaller
- pros - you still can create wrapper, but using Python
In my opinion, the better way to go is to “mix”:
Py++ is able to
- expose global and member variable address
- expose “this” pointer value
- expose a class “sizeof”
- expose variable, which has a union type
- return address of return value as integer - new call policy was created