embed python in C++

wkuang wkuang at aludra.usc.edu
Thu Aug 9 02:21:52 CEST 2001


hi,

I am interested in having an interpreter handling my c++ program
input/output to add some flexibility, and someone tells me python maybe
one. I searched through python website and unfortanetly got little
information other than a page saying python could be embeded in C++
program. I am wondering if it is possible to have my c++ program read
memory that python generated. For example,

in c++ program, I have a class defined as,

class myclass {

int i;
myclass* ptr;
...
}

and I define a pointer and somehow send it to python (I suppose I could?)

myclass* classptr;


@ python script, I generate a list of class,

myclass *classInPython = new myclass[10];
(sorry, in cpp syntax)
and set each pointer in class member pointing to the next class (as link
list)

After running script, could I read all the classes in my c++ main
function?

Is there any book or website that elaborate embedding stuff? And any
suggestion on script interpreter other than python is welcomed.

Thanks!

Wan Kuang

Electric Engineering - Electrophysics
University of Southern California
Los Angeles, CA 90007





More information about the Python-list mailing list