Stream: contributing

Topic: Roc Glue


view this post on Zulip Dan G Knutson (Jan 24 2026 at 15:45):

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?

view this post on Zulip Anton (Jan 24 2026 at 15:47):

@Luke Boswell

view this post on Zulip Luke Boswell (Jan 24 2026 at 19:27):

It's not implemented yet.

view this post on Zulip Luke Boswell (Jan 24 2026 at 19:31):

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.

view this post on Zulip Luke Boswell (Jan 24 2026 at 20:16):

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

view this post on Zulip Rick Hull (Jan 24 2026 at 20:50):

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

view this post on Zulip Luke Boswell (Jan 24 2026 at 20:54):

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.

view this post on Zulip Rick Hull (Jan 24 2026 at 21:00):

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

view this post on Zulip Luke Boswell (Jan 24 2026 at 21:00):

That gist is for the old rust compiler... I wouldn't confuse it with anything for the new compiler

view this post on Zulip Rick Hull (Jan 24 2026 at 21:08):

Doh right. Good background info.

view this post on Zulip Dan G Knutson (Jan 25 2026 at 02:59):

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.

view this post on Zulip Luke Boswell (Jan 25 2026 at 02:59):

Sounds good


Last updated: Feb 20 2026 at 12:27 UTC