C++ and Embedded Python

jasonkeddie at hotmail.com jasonkeddie at hotmail.com
Fri Jan 20 08:52:33 EST 2012


Is there a method to allow a pointer to an object in local memory to
be shared with embedded Python within a C++ executable?

The reason I require this is I have a C++ instance of a class that has
data memers that are themeselves pointers to other object types. It is
a fairly complicated object.
In an ideal world I would just pass this pointer into an instance of
the Python interpreter. This would allow the python program access and
change some properties of this object instance, then pass it back to
the calling C++ program. I would use this same system to pass messages
between the C++ (calling program) and the embedded Python interpreter.

I have looked at using shared memory, which will work until you
require embedded pointers within your object as you cannot dynamically
allocate memory in a shared space.

Any help is much appreciated.




More information about the Python-list mailing list