Stream: general

Topic: cranelift


view this post on Zulip lechat (Sep 03 2022 at 20:23):

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?

view this post on Zulip bjorn3 (Sep 04 2022 at 12:25):

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: Nov 22 2024 at 16:03 UTC