[LLVMdev] LLVM C bindings

Jon Harrop jon at ffconsultancy.com
Wed Feb 18 09:14:54 PST 2009


On Wednesday 18 February 2009 16:37:54 Corrado Zoccolo wrote:
> On Mon, 16 Feb 2009 21:18:48 +0000
> Jon Harrop <jon at ffconsultancy.com> wrote:
> > 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.
>
> XML-RPC assumes you want an external server, or it can be used from
> the same process?

You can do it entirely in process by passing strings. This requires a minimal 
C API at either end and autogenerated serialization code.

> If SWIG is not mature enough, and/or doesn't provide the needed level
> of flexibility, we have other options:
>
> * write a llc backend that generates C-bindings for C++ compiled code
> (general solution, could replace SWIG).

Metaprogramming using LLVM itself is certainly the best way forward in the 
long term (IMHO) but it would be much more alluring if Clang could compile 
LLVM itself...

In the mean time, I think it would probably be much easier to reuse some 
existing tools for C++. Surely there are some mature tools to expose a C++ 
API in a language agnostic way?!

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



More information about the llvm-dev mailing list