llvm_sys::execution_engine

Function LLVMCreateMCJITCompilerForModule

Source
pub unsafe extern "C" fn LLVMCreateMCJITCompilerForModule(
    OutJIT: *mut LLVMExecutionEngineRef,
    M: LLVMModuleRef,
    Options: *mut LLVMMCJITCompilerOptions,
    SizeOfOptions: size_t,
    OutError: *mut *mut c_char,
) -> LLVMBool
Expand description

Create an MCJIT execution engine for a module, with the given options.

It is the responsibility of the caller to ensure that all fields in Options up to the given SizeOfOptions are initialized. It is correct to pass a smaller value of SizeOfOptions that omits some fields. The canonical way of using this is:

LLVMMCJITCompilerOptions options;
LLVMInitializeMCJITCompilerOptions(&options, sizeof(options));
// ... fill in those options you care about
LLVMCreateMCJITCompilerForModule(&jit, mod, &options, sizeof(options),
                                 &error);

Note that this is also correct, though possibly suboptimal:

LLVMCreateMCJITCompilerForModule(&jit, mod, 0, 0, &error);

0 is returned on success, or 1 on failure.