ocaml-wasm / wasm_of_ocaml

Other
247 stars 9 forks source link

Dynlink support #88

Open vouillon opened 1 month ago

vouillon commented 1 month ago

It would be cool to be able to run an OCaml toplevel or Coq in a browser.

Directly loading wasma/wasmo files should be easy. Maybe we want to provide a way to turn them into a directory containing the Wasm code and a source map?

Dynlink for cmo / cma files would require more work. One need to embed some bytecode metadata. The linking convention might be a different as well (going through an array of global data).

Js_of_ocaml provides a virtual filesystem that can contain the libraries and the cmi files. We probably want to implement this functionality as well. Alternatively, with the JSPI API, it should be possible to load these files asynchronously from the Web server.

Finally, to compile cmo files we will need to embed wasm_of_ocaml. But we probably do not want to embed Binaryen as well. So we probably want to generate Wasm binary modules directly (see #90).