Utterly mysterious ... :thinking:
What do these mean? What is the difference between "exposed" and "exposed_generic"?? Why does "1" start at one and not zero? Can I have more than one "main" exposed to the platform? Did I miss some documentation?
Guidance appreciated!!
What are you working on/trying to do? Generally, beginners don't jump right into this stuff.
Not sure yet.. Trying to figure things out...
If you are just trying to write a basic application in roc to get a feel for the language, I would advise first following the tutorial and then messing around with basic-cli.
I'm past that already. I want my own platform. With support for concurrency/async. What is the difference between "exposed" and "exposed_generic"?? Sure it's some easy stuff explained in two or three sentences. Backwards/legacy stuff?? pls!!
Sure, though if you are building your own platform, I would highly advise making it a rust platform and using roc glue
to avoid needing to know many of these low level details.
"exposed" -> standard cabi
"exposed_generic" -> wrapper where the output is passed in as a pointer
"cabi"??
c abi
What does "exposed_generic" return? Nothing? Void?
yeah, it should be void.
`> Why does "1" start at one and not zero?
IIRC, This is the internal layout id of the function.
ok, make sense! Thanks!
Brendan Hansknecht said:
Sure, though if you are building your own platform, I would highly advise making it a rust platform and using
roc glue
to avoid needing to know many of these low level details.
roc glue btw. does not work for me: "thread 'main' panicked at 'called' 'Option::unwrap()' on a 'None' value..."
can you share the full command you used?
Brendan Hansknecht said:
can you share the full command you used?
./roc glue RustGlue.roc platform/ main.roc
can you also share the full error, should have a src file and line number hopefully.
ok sorry I must type it all...
"thread 'main' panicked at 'called Option::unwrap()
on a None
value' crates/glue/src/load.rs:390:50 note: run with RUST_BACKTRACE=1
environment variable to display a backtrace"
that is not at all where I expected an error to be. Any chance you can share your main.roc
file?
`app "arbitmon-backend"
packages { pf: "platform/main.roc" }
imports [pf.Effect.{Effect, Future}]
provides [main] to pf
main : Effect Future
main =
future <- Effect.after Effect.sleep
Effect.always future
`
'`platform "arbitmon-backend-platform"
requires {} { main : Effect Future }
exposes []
packages {}
imports [Effect.{ Effect, Future }]
provides [mainForHost]
mainForHost : Effect Future as Fx
mainForHost = main`'
'hosted Effect
exposes [Effect, after, always, sleep]
imports []
generates Effect with [after, always]
Future := Nat
sleep : Effect Future
'
That's it.
With those files (after re-adding tabbing), this works for me:
roc glue crates/glue/src/RustGlue.roc /tmp/test/platform/glue /tmp/test/platform/main.roc
Brendan Hansknecht said:
With those files (after re-adding tabbing), this works for me:
roc glue crates/glue/src/RustGlue.roc /tmp/test/platform/glue /tmp/test/platform/main.roc
Won't work for me. Even when giving an absolute path it changes the path in a nonsensical way:
./roc glue RustGlue.roc ./glue /home/shaiden/roc_test/src/platform/main.roc
The error I get is:
FileProblem { filename: "/home/shaiden/roc_test/src/../platform/main.roc", error: NotFound }
I don't know where the random "/../" comes from, but I couldn’t get rid of it ...
Last updated: Jul 06 2025 at 12:14 UTC