[LLVMdev] Parsing (and compiling) on demand.

Nick Lewycky nicholas at mxc.ca
Sat Apr 17 13:21:00 PDT 2010

lost wrote:
> So  you mean that is not the way. But what is InstallLazyFunctionCreator for?

You can use it to return a function pointer when asked for a function by 
name. It can replace dlsym() style lookups.

I would've expected that given its name it could be used to lazily 
create functions too, but apparently not.


> 2010/4/17 Kenneth Uildriks<kennethuil at gmail.com>:
>> On Sat, Apr 17, 2010 at 2:15 PM, Nick Lewycky<nicholas at mxc.ca>  wrote:
>>> lost wrote:
>>>> Ok than, but how to insert a call to an undefined function?
>>> You need to have the function declaration and insert a call to that.
>>> Once your LazyFunctionCreator is called, you fill in the body and call
>>> JIT->getPointerToFunction() on it and return that result.
>>> I haven't actually tried this, but it seems to be the only way to use
>>> this API, so I presume someone else has. The only potential problem I
>>> can forsee is if the JIT isn't actually re-entrant.
>> I actually tried that several months ago and, it turned out, the JIT
>> wasn't actually reentrant and didn't like that at all.

More information about the llvm-dev mailing list