[LLVMdev] Running functions built with the LLVM C API

Rob Rix rob at monochromeindustries.com
Thu Dec 24 12:37:29 PST 2009

Hello all,

The Kaleidoscope tutorial shows how to get a void pointer to the a built function, cast it to the appropriate type, and then call it.

There isn’t a tutorial using the LLVM C API that I’ve seen, so I’ve been working with bits and pieces found online, and of course the header files. I haven’t been able to find an equivalent to getPointerToFunction as yet, however. The JIT example I found[1] is using LLVMRunFunction, with requisite boxing of arguments and unboxing of return value.

Is this the recommended route? Is the C API just lacking a getPointerToFunction equivalent? If so, I imagine it will be fairly straightforward to add one, which I’ll be happy to do.

Thanks very much,

[1]: http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html

Rob Rix, Unknown Quantity
Monochrome Industries

More information about the llvm-dev mailing list