Thread Previous • Date Previous • Date Next • Thread Next |
On Sun, 9 Oct 2005, Johan Jansson wrote:
On Tue, Oct 04, 2005 at 07:29:48PM -0400, Faheem Mitha wrote: ...See the Boost Python tutorial at http://www.boost.org/libs/python/doc/tutorial/doc/html/index.html. Also, see http://www.boost-consulting.com/writing/bpl.html... This looks quite nice, the benefit it has over SWIG is that it uses the C++ compiler itself instead of its own parser. I think SWIG is very hard to beat though: it requires zero changes to the source you want to convert, I just feed it the header files. It can convert to Tcl, Python, Perl, Guile, Java, Ruby, Scheme, Ocaml, etc. (basically any language) by just giving another switch, and it's very mature and widely used.
You don't have to change the source for Boost Python either. You just need to add some wrapper code.
Can SWIG handle arbitrary types and in that case, how do you define the conversion function? What about ownership semantics, references, smart pointers and so forth?
From a time-saving and maintainability point of view, SWIG definitelyhas the edge on Boost.Python. We should keep an eye on it though, it does seem to have a cleaner architecture.
I can send you some example code if you like. I have been thinking of writing a Boost Python tutorial on wrapping C++ code which is actually useful. :-)
But I have to find the time to do so. There is a Boost Python code generating engine called pyste (http://www.boost.org/libs/python/pyste/), which is usable, because a colleague used it, though I prefer to write my wrappers by hand. Faheem.
Thread Previous • Date Previous • Date Next • Thread Next |