Just to expound a bit on pygccxml, which really makes boost worth it.<div><br></div><div>pygccxml enables you to do all of your binding work from within Python. It calls gccxml, which is an xml backend to gcc that outputs the parse tree in an xml format. Pygccxml provides a very high level interface between the gcc xml representation and the pygccxml boost code generator. It's really a great thing. You just have to learn to read the code that pygccxml outputs for boost, and then go back to python and use the high level interface to modify the code that it outputs. It has all sorts of selectors so you can operate on all code that has certain arbitrary properties all at the same time.</div>
<div><br></div><div>Play with it before deciding on swig. It's frikkin' cool :)<br><br><div class="gmail_quote">On Thu, Jun 4, 2009 at 3:01 PM, Brian <span dir="ltr"><<a href="mailto:Brian.Mingus@colorado.edu">Brian.Mingus@colorado.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Well you'll just have to try Boost.Python. There is a pygccxml gui gets you started in about 15 minutes. You'll be able to see how well it groks your code and what that generated code is.<br>
<br>Boost is the best. People complain about it because they don't understand C++ templates and they don't realize how incredibly well designed it is.<br>
<br>If you don't know the basics it's this: Boost.Python uses meta template programming. This allows it to use the C++ preprocessor for what other binding systems generally write a custom tool for. Long compile times are not a real problem for anyone - it's easy to set up a compile farm and the benefit is that your runtime code is blazing fast.<br>

<br>In my opinion Boost is more sophisticated, SWIG, etc.. is more of a hack. Of course they all help you get the job done.<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Thu, Jun 4, 2009 at 2:54 PM, Philip Semanchuk <span dir="ltr"><<a href="mailto:philip@semanchuk.com" target="_blank">philip@semanchuk.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div><br>
On Jun 4, 2009, at 4:23 PM, Brian wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
What is the goal of this conversation that goes above and beyond what<br>
Boost.Python + pygccxml achieve? Boost has published a variety of libraries<br>
that will be included into the next c++ standard. It's hard to imagine a<br>
better designed python/c++ interface library than Boost.Python. Further,<br>
pygccxml is amazing with regards to scanning your source code using gcc<br>
itself and then using that xml representation to write out the Boost.Python<br>
code. What more do people in this conversation want?<br>
</blockquote>
<br></div>
Hi Brian,<br>
I've only experimented with SWIG (and ctypes for wrapping a C library). We're not yet sold on using SWIG to wrap our C++ libraries and so we're exploring alternatives. Before I started with SWIG, I did some research to see what other folks were using. The arguments I recall reading that swayed me to try SWIG before Boost were --<br>


- Boost involves more "magic" than SWIG which means it does a bit more work for you, but when things go wrong (i.e. interface won't compile or doesn't work as expected) it is very difficult to debug.<br>


- Boost-ed code requires a Boost runtime library. This isn't a showstopper problem, obviously, but it's a  mark against since it adds yet another prerequisite to our install process.<br>
- Boost's generated code can take a long time to compile.<br>
<br>
I don't know what pygccxml adds to the equation, so perhaps some of those disadvantages disappear with Boost.Python + pygccxml versus just plain Boost.Python. If you'd like to expound on this, feel free. I'd appreciate the education.<br>


<br>
I don't know about what Boost (or any other tool) generates, but the interface I got out of SWIG was not pretty. That's no knock on SWIG -- I'm amazed at what it can do. Nevertheless the generated interface has all the charm of a Babelfish translation. I imagine lots of autogenerated code looks "babelfish-ed": meaning is preserved, albeit crudely, but all the idioms are lost and it's eminently clear that it was not created by a native speaker.<br>


<br>
Until there's an interface generation tool that can build an interface that makes the wrapped library look completely Pythonic, then choosing a tool will be a matter of choosing which compromises you want to make. As long as that's true, I think there's room for multiple library-wrapping packages, just like there's room for more than one programming language in the world.<br>


<br>
Cheers<br><font color="#888888">
Philip<br>
<br>
<br>
<br>
<br>
</font><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div>
<br>
<br>
On Thu, Jun 4, 2009 at 2:07 PM, Thomas Heller <<a href="mailto:theller@python.net" target="_blank">theller@python.net</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Philip Semanchuk schrieb:<br>
<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Hi Thomas,<br>
We're weighing options for accessing C++ objects via Python. I know of<br>
SIWG and Boost; are there others that you think deserve consideration?<br>
</blockquote>
<br>
I haven't used any of them myself.  A common suggestion is SIP,<br>
less known are pybindgen and Robin.  But there may be many more,<br>
and others with more experience might have much more to say about them.<br>
Also there is Roman Yokavenko's pygccxml which has a lot of stuff.<br>
<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
I've been happy with ctypes in my limited exposure to it and would<br>
love to find a way to make that work. This thread has been very<br>
interesting to me.<br>
</blockquote>
<br>
Unfortunately there is no solution in sight, with ctypes.<br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
<br>
</blockquote></div>
-- <br><div>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></blockquote>
<br>
-- <br><div><div></div><div>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br></div>