Extending a C++ App

Greg Green gregory.p.green at boeing.com
Thu Sep 12 15:14:36 EDT 2002


Embedding python inside an application can be simple. The basic step
is to call Py_Initialize(). After that you can execute python code
with the PyRun_* functions. Of course, in practice, there is a lot
more to worry about. Threads and the GIL, if you are using a GUI, you
have to worry about the event loop, etc.

Accessing your c++ object model requires you to wrap them just as if
you were going to use the model in a python program. The normal
answers are swig, sip, boost and some others. I've used both swig,
sip, and writing the wrapper by hand. All will work. Once the api is
wrapped, the resulting code is either statically or dynamically linked to
your exe.

-- 

Greg Green




More information about the Python-list mailing list