[LLVMdev] LLVM C bindings

Jon Harrop jon at ffconsultancy.com
Mon Feb 16 13:18:48 PST 2009


On Monday 16 February 2009 20:04:38 Paul Melis wrote:
> Corrado Zoccolo wrote:
> > Unfortunately, it seems that llvm-c interface lacks major
> > functionalities, e.g. getting a pointer to a jit-ted function.

Yes. I similarly found that tail calls, sret and parts of first-class structs 
are not usable from OCaml and much of the functionality was not implemented 
in the C API in LLVM 2.4.

> SWIG (www.swig.org) recently added a C output mode, that is capable of
> generating a C API for a C++ one.
> It was a Summer of Code project, so I'm not sure how mature it is. The
> docs are here:
> http://swig.svn.sourceforge.net/viewvc/swig/branches/gsoc2008-maciekd/Doc/M
>anual/C.html

The generation of this FFI code should certainly be automated. However, if the 
necessary tools are not yet stable perhaps it would be wise to consider 
looser bindings such as XML-RPC? I assume there are tools that can examine a 
C++ API from headers in order to create an XML-RPC server automatically?

An XML-RPC API would be trivial to use and extend from languages like OCaml 
and Python and the interface code should not require any maintenance at all.

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e



More information about the llvm-dev mailing list