Hello. I am new to Cranelift-jit. I hope this is the right place to ask.
I want to do something like this and call this from cranelift:
pub extern "C" fn to_jitval(ptr: *mut Parameter) -> (i64, i64) {
let r = unsafe {Box::from_raw(ptr)};
(r.value, r.value_type)
}
This works, I successfully receive multiple return values when it is called from cranlift jit.
But I think this return type (tuple) is unstable usage of ABI. Is it unsafe to do this? How can I return multiple values from a function?
multi-return doesn't work for the C abi. You will have to instead pass for example a pointer where the callee can write the return value to.
Last updated: Dec 23 2024 at 13:07 UTC