[LLVMdev] Lifetime of ExecutionEngine?
Paul J. Lucas
paul at lucasmail.org
Tue Oct 23 11:31:01 PDT 2012
Given:
typedef MyClass* (*jit_fn_ptr_type)();
MyClass* set_fn( llvm::Function *fn ) {
// create an ExecutionEngine 'exec' ...
jit_fn_ptr_type fn_ptr = (jit_fn_ptr_type)exec->getPointerToFunction( fn );
return fn_ptr();
}
After I call getPointerToFunction() to obtain the pointer to the JIT'd function and fun the function (that will produce an instance of MyClass on the heap), do I still need 'exec'?
Deleting it immediately after use seems to have no adverse effect. I just want to double-check that this is OK.
- Paul
More information about the llvm-dev
mailing list