The JIT demo in the official repository transmutes the returned pointer to a rust function type. Wouldn't this mean cranelift's compiler backend produces the same ABI as the rust compiler? (And AFAIK Rust doesn't have a stable ABI.) I would have expected it to produce a Rust extern "C"
function. I didn't do a thorough search, but I couldn't find documentation on it either. Could someone clarify? Thanks!
That code is wrong. It should indeed be extern "C"
. While it is likely to work when only primitive types are passed, it definitively won't work as soon as more complex types are passed.
I see, thanks for clarifying! Should someone/I submit a fix to the example? (I don't necessarily want to clutter PRs with trivial changes)
Raekye has marked this topic as resolved.
If you don't mind a PR is appreciated.
Last updated: Dec 23 2024 at 12:05 UTC