embeding python in C++ ??

Jody Winston jody at sccsi.com
Thu Feb 3 09:54:56 EST 2000


jerryjerry at aol.com (JerryJerry) writes:

> I would like to embed python within a C++ application. I want to call python
> scripts from C++ objects and call C++ object methods from python scripts.
> 
> Does anyone have experience with this?
> 
> I am new to Python, so I don't know how involved this is, or if it is even
> possible.
> 
> Thanks in advance.
> Jerry

It's basically very easy to do.  For an overview look at the extending 
and embedding documentation and the files in Demo/embed.

One approach would be to down load SWIG (www.swig.org) and use it to
wrap your code.  This is a good approach if your code doesn't use
templates.  Anther approach is to use the work of the C++ sig.  This
approach is more friendly to templated code.

-- 
Jody Winston



More information about the Python-list mailing list