Stream: show and tell

Topic: roc platform templates


view this post on Zulip Luke Boswell (May 18 2024 at 13:13):

Just wanted to share an update for platform template repositories. Mostly copied from platform-switching examples for now. The idea is to have a more idiomatic example using the host language ecosystem e.g. build.rs, or build.zig etc.

https://github.com/lukewilliamboswell/roc-platform-template-go
https://github.com/lukewilliamboswell/roc-platform-template-swift
https://github.com/lukewilliamboswell/roc-platform-template-zig
https://github.com/lukewilliamboswell/roc-platform-template-rust
https://github.com/lukewilliamboswell/roc-platform-template-c

I figured it would be useful to share what I have so far, however there are a couple of changes I would like to make in the short term;

Things I think will be helpful in the medium/long term;

view this post on Zulip Luke Boswell (May 18 2024 at 13:29):

Another idea -- add example github actions for packaging and docs

view this post on Zulip Luke Boswell (May 18 2024 at 19:08):

I've updated the zig platform to use a Task based API now.

If anyone with some Zig experience is able to cast their eyes over it, that would be appreciated.

Maybe @Silver you are interested?

view this post on Zulip Damian Reeves (May 18 2024 at 22:43):

Ia there a reason why the roc examples shows JVM interop as opposed to a platform? What is the main distinction?

view this post on Zulip Luke Boswell (May 19 2024 at 04:19):

I haven't looked at that example (I haven't used Java before). But my guess is that for the JVM we need to have the host toolchain drive the linking. So we compile the roc app into an object first using roc build --no-link and then use the C header and FFI to call into roc.

view this post on Zulip Luke Boswell (May 19 2024 at 04:20):

That is a similar workflow to the roc-wasm4 platform, where we have zig control the build so we have finer control over the memory layout of the final .wasm library, but in this case it is so we can interop in a way that works for Java.

view this post on Zulip Luke Boswell (May 20 2024 at 06:11):

Some updates to the above;


Last updated: Jul 06 2025 at 12:14 UTC