[LLVMdev] Ocaml bindings (and ExecutionEngine)
Gordon Henriksen
gordonhenriksen at mac.com
Fri Oct 19 10:23:24 PDT 2007
On Oct 19, 2007, at 11:51, Jan Rehders wrote:
> this looks very promising. Do you have any plans to add bindings
> for the use of an ExecutionEngine, especially
> recompileAndRelinkFunction?
I'd considered it on the basis that others may find it useful, but I
have no immediate need for it.
Patches are welcome. Binding a method is trivial:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-
Mon-20071001/054282.html
And even binding a new library is straightforward:
1. Add C bindings for the desired functionality. (Strictly speaking,
this is optional.)
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/
Analysis.h?view=markup&pathrev=42707
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/
Analysis.cpp?view=markup&pathrev=42707
2. Copy up a bindings project.
http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/
analysis/?pathrev=42707
http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/
Makefile?r1=42707&r2=42706&pathrev=42707
3. And add tests for it.
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/
Ocaml/analysis.ml?view=markup&pathrev=42707
> I've build an interactive toplevel implemented in OCaml and I have
> to pull of some stunts to be able to change the definition of a
> function. (emit a .ll file containing the code, looking up the
> function and calling removeBody, then reading the .ll file back in
> using ParseAssemblyString). I noticed that functions are
> represented as an llvalue which makes turning it into a Function*
> unsafe if I'm correct?
Yes, llvalues are very weakly typed. If assertions are enabled in the
LLVM build, then any misuses will be caught by the 'wrap' and
'unwrap' helpers in the C bindings.
— Gordon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071019/ab541dcd/attachment.html>
More information about the llvm-dev
mailing list