I'm a little conceptually confused on the glue files you can find for rust and zig. These files let the platform call other zig and rust code and use it within the roc program? Or is it allowing the roc platform to be called as if it were rust / zig code?
glue is made to make platform development easier
A platform can be written in any language.
Rust is currently the most supported.
glue will generate rust/zig/etc bindings that a platform can use to interact with a roc app
Gotcha, so the platform runs the Roc code. The bindings allow I/O between a rust program and the platform itself, correct?
The rust program is the platform.
I'll try to be a bit more specific:
A Roc program is split into two core pieces: a platform and an application.
The application is just pure roc code and libraries. This is what a user writes.
The platform is split into two more pieces: the host and the roc api.
The host can be written in any language that can talk C FFI. It uses C FFI to interact with the roc api.
So the full picture is:
host -> c ffi -> roc api -> application
glue generates the c ffi part for various languages.
Ahh, okay thank you! I realize I misunderstood how the platform worked. Appreciate it!
general doc on platforms for reference: https://www.roc-lang.org/platforms
Last updated: Jul 06 2025 at 12:14 UTC