What's the state of roc glue? I know that it's not implemented in the new toolchain, but is there a plan or design doc kind of thing? Is this something that would be reasonable for me to work on, or should I wait / hack it without?
@Luke Boswell
It's not implemented yet.
I have a thing I made which is similar, I intended it to be a halfway thing or stepping stone.
I rebased and made a draft PR so I could share it https://github.com/roc-lang/roc/pull/9082
This give you a flag --dump-platform-abi=<path> to generate a C header file from a platform ABI
$ roc build --help
Build a binary from the given .roc file, but don't run it
Usage: roc build [OPTIONS] [ROC_FILE]
Arguments:
[ROC_FILE] The .roc file to build [default: main.roc]
Options:
--output=<output> The full path to the output binary, including filename. To specify directory only, specify a path that ends in a directory separator (e.g. a slash)
<snipped>
--dump-platform-abi=<path> Generate C header file with platform ABI
AFAIK there isn't a design doc for roc glue -- but we are copying the functionality from the old rust compiler so we could glean from that.
I asked claude to summarise how it worked in the rust compiler https://gist.github.com/lukewilliamboswell/c75da540018770e0a960fa158cc9bec4
sharing here to save anyone the tokens if they wanted to do the same
I was wondering A, how do roc types work in host-lang and B, wtf is roc glue. I am just using List(U8) in my host API, and then parse-don't-validate into nominal tag union with methods. Not sure i want glue in this specific context. Though i guess have my own glue for List(U8), not sure
It mostly helps when you want to use custom type like a record or a list containing other types like List(MyOtherThing) then you don't have to hand roll the source code for MyOtherThing and get that right (field ordering, alignment, padding, etc) for different architectures. When you have more complex types like nested tag unions with payloads etc it gets really difficult very quickly if these aren't generated for you. If you make a change to the Roc type, it can be much easier to just regenerate the source that matches that then trying to keep them in sync manually.
I'd like host this doc in roc-init, at least temporarily. Roc-init is completely application-focused, right now, but I have a few plat-dev docs off in a dusty corner
That gist is for the old rust compiler... I wouldn't confuse it with anything for the new compiler
Doh right. Good background info.
I got started on adding a roc glue command for the Zig toolchain. I don't know how built-out it should be before opening a PR, but I can at least throw a draft up tomorrow.
Sounds good
Last updated: Feb 20 2026 at 12:27 UTC