Until now, it was difficult to use a go-platform. You first had to build roc and afterwards go. So the user of the platform had to install and run go to run the roc code.
With the recent change to roc, this is not necessary anymore. Now, it is possible to preprocess a go-platform, as you would preprocess any other platform. The user of the platform does not have to install or run go. He/She can just use the prebuilt-platform, and let the surgical linker combine the go-platform and the roc code.
A go-platform now behaves the same as any other platform.
To preprocess a go-platform, you can use the following commands:
roc build --lib path/to/example/main.roc --output platform/libapp.so
CC="zig cc" go build -C platform -buildmode=pie -o dynhost
roc preprocess-host path/to/example/main.roc
roc run --prebuilt-platform my_app/main.roc
Awesome, thanks for sharing this!
If the platform is distributed as a URL, the default is to use the prebuilt-platform, so end users (app authors) can just use roc run app/main.roc
:smiley:
Last updated: Jul 06 2025 at 12:14 UTC