# OCaml, FFI, and WASM

**URL:** <https://discuss.ocaml.org/t/ocaml-ffi-and-wasm/4072>\
**Category:** Learning\
**Created:** [July 9, 2019, 1:05pm UTC](https://discuss.ocaml.org/t/ocaml-ffi-and-wasm/4072 "2019-07-09T13:05:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeroexcuses](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/zeroexcuses/32/1692_2.png) [@zeroexcuses](https://discuss.ocaml.org/u/zeroexcuses)\
**Post date:** [July 9, 2019, 1:05pm UTC](https://discuss.ocaml.org/t/ocaml-ffi-and-wasm/4072/1 "2019-07-09T13:05:19Z")

</div>

1. I know it is possible to do OCaml \<-\> C FFI

2. I know it is possible to run OCaml as a REPL in JS.

====

Question: is there any sample code which shows how to:

- let libFoo be some FFI (C, C++, Rust) library with OCaml bindings

- libFoo can be compiled to WASM32

- I want us to have an OCaml REPL running inside the browser that can also interface with libFoo (compiled to WASM).

====

In theory, we can just “combine the two parts” and it should work. In practice, there are lots of unexpected emscriptsen/wasm32 issues, and I’m wondering if someone has a minimal working example for this.

Thanks!
