Fix ABI of jitted function in cranelift-jit example. (#5736)

This commit is contained in:
Raekye
2023-02-07 13:16:05 -08:00
committed by GitHub
parent 72962c9f08
commit fdd4a778fc

View File

@@ -84,7 +84,7 @@ fn main() {
let code_b = module.get_finalized_function(func_b); let code_b = module.get_finalized_function(func_b);
// Cast it to a rust function pointer type. // Cast it to a rust function pointer type.
let ptr_b = unsafe { mem::transmute::<_, fn() -> u32>(code_b) }; let ptr_b = unsafe { mem::transmute::<_, extern "C" fn() -> u32>(code_b) };
// Call it! // Call it!
let res = ptr_b(); let res = ptr_b();