Name Date Size #Lines LOC

..15-May-2026-

ocaml/H15-May-2026-194154

src/H15-May-2026-448287

tests/H15-May-2026-4134

Cargo.tomlH A D15-May-2026788 2621

README.mdH A D15-May-20261.2 KiB3829

build.rsH A D15-May-20263.6 KiB9867

README.md

1wasm-spec-interpreter
2=====================
3
4This project shows how to use `ocaml-interop` to call into the Wasm spec
5interpreter. There are several steps to making this work:
6 - building the OCaml Wasm spec interpreter as a static library
7 - building a Rust-to-OCaml FFI bridge using `ocaml-interop` and a custom OCaml
8   wrapper
9 - linking both things into a Rust crate
10
11### Dependencies
12
13This crate only builds in an environment with:
14- `make` (the Wasm spec interpreter uses a `Makefile`)
15- `ocamlopt`, `ocamlbuild` (available with, e.g., `dnf install ocaml`)
16- Linux tools (e.g. `ar`); currently it is easiest to build the static
17  libraries in a single environment but this could be fixed in the future (TODO)
18- `libgmp`, for the OCaml `zarith` package
19- `git` is used by `build.rs` to retrieve the repository containing the Wasm
20  spec interpreter; it is safe to completely remove `ocaml/spec` to get a new
21  copy
22
23### Build
24
25```
26cargo build --features build-libinterpret
27```
28
29Use `FFI_LIB_DIR=path/to/lib/...` to specify a different location for the static
30library (this is mainly for debugging). If the `build-libinterpret` feature is
31not provided, this crate will build successfully but fail at runtime.
32
33### Test
34
35```
36cargo test --features build-libinterpret
37```
38