Struct gccjit::CompileResult
source · pub struct CompileResult { /* private fields */ }
Expand description
Represents a successful compilation of a context. This type provides the means to access compiled functions and globals. JIT compiled functions are exposted to Rust as an extern “C” function pointer.
Implementations§
source§impl CompileResult
impl CompileResult
sourcepub fn get_function<S: AsRef<str>>(&self, name: S) -> *mut ()
pub fn get_function<S: AsRef<str>>(&self, name: S) -> *mut ()
Gets a function pointer to a JIT compiled function. If the function does not exist (wasn’t compiled by the Context that produced this CompileResult), this function returns a null pointer.
It is the caller’s responsibility to ensure that this pointer is not used past the lifetime of the CompileResult object. Second, it is the caller’s responsibility to check whether or not the pointer is null. It is also expected that the caller of this function will transmute this pointer to a function pointer type.
sourcepub fn get_global<S: AsRef<str>>(&self, name: S) -> *mut ()
pub fn get_global<S: AsRef<str>>(&self, name: S) -> *mut ()
Gets a pointer to a global variable that lives on the JIT heap.
It is the caller’s responsibility to ensure that the pointer is not used past the lifetime of the CompileResult object. It is also the caller’s responsibility to check whether or not the returned pointer is null.