Porting ocaml to js


I am porting an ocaml program to run it in the browser. I lack mainly two things:

  • how to simulate a Ctrl-C and raise Break ?
  • it is only my “main” file that needs changes (thanks to effect) and I would like a target than depends on the mode with dune. Is this possible ? I would like to avoid library variant which are not suitable for a small main file.

I also probably found a bug in js_of_ocaml:

input_value/output_value seem not to work, while marshalling to a string and sending both the size of the string and the string do work (with no other changes). There seems to be a problem when we reach a size of 64Kb … A buffer problem ? May be this is a bug only when using effect.


Please open an issue on the js_of_ocaml bug tracker Issues · ocsigen/js_of_ocaml · GitHub, ideally with a reproduction case.

I could not reproduce the issue on a simple piece of code. I will do a branch on github that reproduce the bug.