Compile the given context and load in into a binary module wrapped in a Result
.
Get the address of a function inside the compiled Result
.
Wrap a function address to a closure. The closure type is specified by user.
Example #
let func : IO Unit ← res.getFunction! "jit_entry_point" 1
Safety #
This function must be used with care. It is up to the user's responsibility to ensure that target function
conforms the Lean4's Uniform ABI (that is, roughly, inputs and outputs are boxed). Notice that apart from
normal function types, IO α
, as shown in the example above, can also be used as the a closure that takes
a RealWorld
as an input.
Get the address of a global variable inside the compiled Result
. One way to access the data
behind the address is to use some self-defined inline C code.
Unload and release the memory resource associated with the compiled Result
.
Safety #
It is up to the user's responsibility to ensure that the Result
and also the symbols/functions inside it are not used
after calling this function.