wasm-micro-runtime/samples/wasm-c-api
YAMAMOTO Takashi 88b5f6a535
samples/wasm-c-api: remove unused valgrind detection (#4249)
- it's unused
- valgrind is basically a linux-only software.
  it isn't a good idea to make it a hard requirement.
  if we want to use valgrind, it's better to introduce
  a separate option to control it.
2025-05-07 11:32:29 +08:00
..
src Change WASM_ANYREF to WASM_EXTERNREF (#3426) 2024-05-14 11:08:16 +08:00
CMakeLists.txt samples/wasm-c-api: remove unused valgrind detection (#4249) 2025-05-07 11:32:29 +08:00
README.md fix: correct typos and improve comments across multiple files by codespell (#4116) 2025-03-07 08:21:54 +08:00

WAMR supports wasm-c-api in both interpreter mode and aot mode.

Before staring, we need to download and install WABT.

$ cd /opt
$ wget https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz
$ tar -xzf wabt-1.0.31-ubuntu.tar.gz
$ mv wabt-1.0.31 wabt

By default, all samples are compiled and run in "interpreter" mode.

$ mkdir build
$ cd build
$ cmake ..
$ make
$ # it will build a library with c-api supporting.
$ # Also copy *.wasm from ../src/
$ # and generate executable files
$ # now, it is ok to run samples
$ ./hello
$ ...
$ ./global
$ ...
$ ./callback
$ ...

They can be compiled and run in aot mode when some compiling flags are given.

$ mkdir build
$ cd build
$ cmake -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_AOT=1 ..
$ make
$ # it will build a library with c-api supporting.
$ # Also copy *.wasm from ../src/
$ # and transform *.wasm to *.aot
$ # and generate executable files
$ # now, it is ok to run samples
$ ./hello
$ ...
$ ./global
$ ...
$ ./callback
$ ...