[LLVMdev] LLVM languages cooperation

Vikram S. Adve vadve at cs.uiuc.edu
Tue Feb 24 06:33:01 PST 2004


Sebastian,

LLVM does define a common function call and struct/array/pointer model.  You
could use that to define a language-interoperability scheme, but I think it
would require some special support from the front-ends to translate
functions exposed to a different language to conform with the scheme, or to
generate wrappers for them.  For example, calling a Fortran function
(call-by-reference) from C (call-by-value) would not work automatically --
something has to generate wrappers to allow the call.  The scheme would have
to define an object model and exceptions model.

FYI, a student in my research group is working on an OCaml-to-LLVM
front-end, using the OCaml compilers from Inria.  Another student is
starting on an MSIL-to-LLVM translator and porting a CLI VM.

--Vikram



> Hi all,
>
> I am an LLVM newbie, thinking about using LLVM as the platform for a toy
> language.
>
> In this respect, I was wondering if LLVM could be used to easily weave
> code written in different language. For instance, let's assume I have a
> library written in C, some components written in C++ and some components
> written in OCaml (we also assume an OCaml backend for LLVM). All this
> code gets compiled to LLVM bytecode.
>
> Is there a way, given this bytecode, to access functions and invoke them
> uniformly ?
>
> This may sound rather fuzzy, but thinking of .NET could help : .NET
> allows to write code in any supported language, the objects and
> functions written in these language become available to all supported
> languages. This is made possible because there is a common object model
> build on top of the .NET VM and bridged to all supported languages. I
> know LLVM does not define an object model, but maybe a common function
> call model ?
>
> TIA,
>
>  -- Sébastien
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list