Best way to embed Python in a C++ app?
dave at boost-consulting.com
Sun Mar 30 05:31:20 CEST 2003
Roy Smith <roy at panix.com> writes:
> I'm toying with the idea of embedding Python in an existing C++
> application. As far as I can tell, there are three possible paths I
> could take. There's the raw API, there's SWIG, and there's boost.python.
> I've played with the first two a little over the years, but don't really
> know anything about boost beyond what little I've learned from reading
> the boost web site. It looks like I'm going to need to pass objects
> back and forth from C++ to Python, and (at least on the surface) boost
> looks like it can handle a lot of the messy details of this. On the
> other hand, I'm a little worried that it's still a bit of a work in
Except in that we keep slowly adding improvments, it's not a work in
progress. I don't think it's any different from SWIG in that respect.
> Anybody with experience in all three willing to offer a comparitive
I would suggest that you avoid the raw API if you can. There are so
many details that are easy to get wrong that a high-level wrapping
tool is almost always a better choice.
More information about the Python-list