Open jzimmerman135 opened 11 months ago
This is something I'd love to add to these bindings, but right now it's not feasible in my understanding. Support for wasm in OCaml is still a work-in-progress, see here.
raylib-ocaml
is built on top of the ctypes
library and would need wasm support for ctypes to work. Of the two OCaml wasm compiler projects (wasm_of_ocaml
and wasocaml
) this is in scope for wasocaml
, but I'm not sure of the progress. The last commit on the repo was 4 months ago.
Theoretically, it should also be possible to call into wasm libraries with wasm_of_ocaml
, but I have never tried it. And in any case, this won't work with ctypes
out of the box and would require creating another set of bindings next to the ctypes
one.
A similar approach could be to use today's js_of_ocaml
by calling the wasm code through javascript. Again, this requires a different set of bindings for javascript. Looking through the raylib bindings, there are no javascript bindings which we could re-purpose for this use case.
To summarize, I'd love to support this use case but currently it does not seem feasible because I don't want to create and maintain another set of bindings. However, I have neither used the OCaml wasm compilers in practice nor jsoo
except for toy examples. If there is another way to call into wasm libraries, I'd love to hear it!
I'll leave this ticket open because this use-case is also something I'd like to have
It's going to be forever until we get wasm ocaml going, in the meanwhile I've wondered about using some other ML-like languages for handling the high level game logic and transpiling that over to C/object code with minimal dependencies, and running the rest with C Raylib. Sad but maybe the most practical method.
I was wondering whether you think it's possible to export raylib-ocaml games to WASM?