[C++-sig] swig?

Petrucio petrucio at hoplon.com
Thu Nov 10 18:48:23 CET 2005


In my experience, the compilation of the SWIG wrappers is much, much faster 
than compilation of the boost.python wrappers. The source of errors in 
compilation is also easier to track down, since there's little or no 
templates used in SWIG wrappers.

SWIG is also easier to set up and use, you usually need much less 
declarations of what you want to export, even less than when using Pyste.

It also has a lot of pre-built typemaps that save you a lot of time 
depending on what you want to export, for instance when dealing with 
pointer to basic types, SWIG has an easy solution for that in a typemap, in 
contrast to exporting those using boost.python, wich is not something you 
look forward to.

In the other hand, boost.python is more robust. I lack the memory to give 
you specific examples, but there's some stupid things that SWIG does that 
will blow your mind. Boost.python is also more 'purist', in some sense. But 
since practicality beats purity, I'm more of a SWIG guy.

I made a few performance tests, and expected boost.python to be a clear 
favorite here, but there were not much diference between the two, if I 
remember correctly.

I made a lot of other comparisons between the two, but the results are not 
in this computer. I'll send them some other day, if I remember to get them.

---
Fabio 'Petrucio' Stange - Game Programmer
Hoplon Infotainment - www.taikodom.com


At 10:14 10/11/2005, you wrote:
>I noticed that recent versions of swig have quite significantly advanced the
>support for c++.  I wonder if anyone has experience they can share,
>regarding a comparison of boost::python with a recent swig.
>
>I have been using boost::python for some time, but am interested in
>considering swig, because in my present environment, it would be easier for
>me to deploy code using swig.
>
>_______________________________________________
>C++-sig mailing list
>C++-sig at python.org
>http://mail.python.org/mailman/listinfo/c++-sig




More information about the Cplusplus-sig mailing list