Stream: cranelift

Topic: Use cranelift via C ABI


view this post on Zulip Kyren (Apr 06 2026 at 21:49):

Hey, I ma writing my own compiler, not written in Rust and I wanted to use cranelift, does it have any C ABI I could use to dynamically link it to my project?

view this post on Zulip Chris Fallin (Apr 06 2026 at 21:56):

Unfortunately no. This is something we might be interested in taking PRs for, though -- the equivalent of the c-api crate for Wasmtime, but for cranelift-codegen + cranelift-frontend. It would be a nontrivial amount of work, though

view this post on Zulip Frank Rehwinkel (Apr 22 2026 at 15:01):

There was another thread in this forum about how most of Cranelift was compiled down to WASM, so while not a C API, the interface to the WASM binary was probably spelled out very clearly. There they already had a JVM that could run WASM so they already had a host environment. Exception handling or traps still required some hand edits I think.

view this post on Zulip bjorn3 (Apr 22 2026 at 15:31):

I think https://github.com/roastedroot/chicory-redline/blob/main/wasm-build/src/lib.rs is the rust side of their c api.

view this post on Zulip Till Schneidereit (Apr 22 2026 at 19:49):

@andreaTP is on here and could probably shed more light on it


Last updated: May 03 2026 at 21:15 UTC