I am trying to make myself a custom C platform, but have been struggling to figure out the most basic steps.
How do I expose a function in my C platform to my Roc code?
The closest thing I have found only has accessing a Roc function in C, but not the other way around: https://github.com/roc-lang/roc/blob/main/examples/platform-switching/c-platform/host.c
Thank you in advance for any answers or for pointing me in the direction of the pertinent documentation.
I wrote an article which kind of touches on this. I'm only learning myself, but maybe this helps a little?
https://lukewilliamboswell.github.io/roc-ray-experiment/#step5
Basically, roc platform calls into the host using effects. The platform defines effects which are exposed to the app author via tasks.
Last updated: Jul 06 2025 at 12:14 UTC