Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASM support #36

Open
jzimmerman135 opened this issue Dec 12, 2023 · 2 comments
Open

WASM support #36

jzimmerman135 opened this issue Dec 12, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@jzimmerman135
Copy link

I was wondering whether you think it's possible to export raylib-ocaml games to WASM?

@tjammer
Copy link
Owner

tjammer commented Dec 13, 2023

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

@tjammer tjammer added the help wanted Extra attention is needed label Dec 13, 2023
@sjqtentacles
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants