# Porting ocaml to js

**URL:** <https://discuss.ocaml.org/t/porting-ocaml-to-js/14814>\
**Category:** Community\
**Tags:** js\_of\_ocaml\
**Created:** [June 18, 2024, 7:26pm UTC](https://discuss.ocaml.org/t/porting-ocaml-to-js/14814 "2024-06-18T19:26:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![craff](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/craff/32/3281_2.png) [@craff](https://discuss.ocaml.org/u/craff)\
**Post date:** [June 18, 2024, 7:26pm UTC](https://discuss.ocaml.org/t/porting-ocaml-to-js/14814/1 "2024-06-18T19:26:01Z")

</div>

Hello,

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.

Cheers,  
Christophe

---

<div class="post-metadata">

**Author:** ![hhugo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/hhugo/32/1143_2.png) [@hhugo](https://discuss.ocaml.org/u/hhugo)\
**Post date:** [June 18, 2024, 9:59pm UTC](https://discuss.ocaml.org/t/porting-ocaml-to-js/14814/2 "2024-06-18T21:59:49Z")

</div>

Please open an issue on the js\_of\_ocaml bug tracker [Issues · ocsigen/js\_of\_ocaml · GitHub](https://github.com/ocsigen/js_of_ocaml/issues), ideally with a reproduction case.

---

<div class="post-metadata">

**Author:** ![craff](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/craff/32/3281_2.png) [@craff](https://discuss.ocaml.org/u/craff)\
**Post date:** [June 22, 2024, 12:16am UTC](https://discuss.ocaml.org/t/porting-ocaml-to-js/14814/3 "2024-06-22T00:16:10Z")

</div>

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