[newbie] Calling Python from C++

Morfeas greek_bill at yahoo.com
Sat Sep 21 19:55:13 EDT 2002

David Abrahams wrote:

> While I appreciate the plug and I do think Boost.Python is a great
> solution for C++, SWIG has evolved since I first did my analysis and it
> understands a lot more of C++ than it used to, though it is still missing
> the ability to instantiate templates. The Boost comparisons page is
> woefully outdated and I've been waiting for David Beazley to write a new
> blurb for SWIG.

I concur. I've managed to do what I want in the end, using SWIG. Altough, I 
must admit I'm not using it (SWIG) the way it was designed to be used! If I 
understand correctly, SWIG (and probably a lot of other similar tools) has 
been designed to make your C (or C++) code visible to Python (and other 
interpreted languages) code. i.e. it helps you write extensions to Python.

What I was trying to do (and finally succeeded) was :
1. to extend an embedded Python interpreter, and
2. allow the python code to interact with existing instances of C++ objects

It took a bit of messing about and hacking at code, but it worked (hey, 
what's another couple of 16 hours days in front of the computer? :)


More information about the Python-list mailing list