On Fri, Mar 28, 2008 at 7:03 PM, Eric Jonas <<a href="mailto:jonas@mit.edu">jonas@mit.edu</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
To anyone on #llvm I'm sure I'm starting to sound like a broken record,<br>
but I'd just like to point out that for python bindings at least, you<br>
can quite easily manipulate the LLVM infrastructure via ctypes as a<br>
shared object / dll -- no C required!</blockquote><div><br>I think it is quite worth while to have a "native" binding in the language. That is, one which meshes to a greater extent with the languages native object model (or provides a functional model as appropriate), naming, and style conventions. That is why I'm particularly curious about a SWIG approach, and the possibility of lowering the effort of this. Basically, it's often not worth building bindings by hand. If SWIG can do it automatically and for multiple languages? That might be worthwhile. Just my 2 cents. This is in no way to say I don't really really like the C-binding for FFI based interfaces. =]<br>
<br>-Chandler<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Those of us interested in talking<br>
to LLVM from Lisps, either Common Lisp (via CFFI) or a scheme like<br>
PLT/Mzscheme, can also use the shared library interface. In fact, for<br>
the Common Lisp case, this is the _only portable_ (cross-implementation)<br>
way of talking to LLVM.<br>
<br>
If anyone's interested in<br>
<br>
Here is a one-off example of python using the shared library approach<br>
and Gordon's excellent C interface (llvm-c):<br>
<br>
<a href="http://pastebin.com/m5197c5e7" target="_blank">http://pastebin.com/m5197c5e7</a><br>
<br>
(the verbosity at the beginning is because of some linkage issues with<br>
the llvm SOs)<br>
<font color="#888888">                ...Eric<br>
</font><div><div></div><div class="Wj3C7c"><br>
<br>
<br>
On Fri, 2008-03-28 at 18:52 -0700, Chandler Carruth wrote:<br>
> If SWIG can be made to do a good job with Python/Ruby/Perl etc<br>
> bindings around LLVM, I would be very interested in this. I'm<br>
> personally interested in seeing both Python and Ruby bindings, and in<br>
> having them be as easily maintained as possible. I think it would be<br>
> interesting to see what the SWIG-style solution can do in this<br>
> direction as opposed to the C-binding approach. If it results in<br>
> better and/or lower maintenance/development cost bindings for specific<br>
> target languages, I'm all for it.<br>
><br>
> -Chandler<br>
><br>
> On Fri, Mar 28, 2008 at 3:55 PM, Søren Bøg <<a href="mailto:sbg@froztek.com">sbg@froztek.com</a>> wrote:<br>
>         Hi,<br>
><br>
>         I've been lurking around the LLVM project for a couple of<br>
>         months now.<br>
>         The two recent threads about python bindings for LLVM ([1] and<br>
>         [2]),<br>
>         combined with the fact that I am looking for at GSoC project<br>
>         at the<br>
>         moment. Lead to the idea of making the "public" parts of LLVM<br>
>         SWIG[3]-friendly and basing a set of python bindings on this.<br>
><br>
>         My reasoning for doing it this way, is that it allows reuse of<br>
>         the SWIG<br>
>         annotation for bindings to other languages such as Perl and<br>
>         Java among<br>
>         others.<br>
><br>
>         What I would like to do for the GSoC is:<br>
>         1) Annotate the necessary parts of LLVM for processing by<br>
>         SWIG.<br>
>         2) Use SWIG to generate a python wrapper around LLVM<br>
>         3) Add a (hopefully) thin layer of python code to complete the<br>
>         bindings.<br>
><br>
>         Before submitting an application for this project. I would<br>
>         like to know<br>
>         if there is an interest in this, within the LLVM project, and<br>
>         possibly<br>
>         if this is already being worked on.<br>
><br>
>         Regards,<br>
>          Søren Bøg<br>
><br>
>         [1]<br>
>         <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-March/013318.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-March/013318.html</a><br>
>         [2]<br>
>         <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-March/013171.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-March/013171.html</a><br>
>         [3] <a href="http://www.swig.org/" target="_blank">http://www.swig.org/</a><br>
>         _______________________________________________<br>
>         LLVM Developers mailing list<br>
>         <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>         <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br>