You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-11Lines changed: 7 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -39,19 +39,15 @@ The example can run using [`wasmi`](https://github.com/paritytech/wasmi).
39
39
The command to run examples (from the top-level directory) is:
40
40
41
41
```sh
42
-
cargo run -- <lang>
42
+
cargo run [--features wasi] -- <lang>
43
43
# or
44
-
cargo run --no-default-features --features <abi> -- <lang>
45
-
# or
46
-
cargo run -- -i <PATH><func><args>
47
-
# or
48
-
cargo run --no-default-features --features <abi> -- -i <PATH><func><args>
44
+
cargo run [--features wasi] -- -i <PATH><func><args>
49
45
```
50
46
51
47
Where:
52
48
53
49
-`<lang>` is `rust`, `zig` or `c`
54
-
-`<abi>` is `abi_unknown` or `abi_wasi` (defaults to `abi_unknown`)
50
+
-add `wasi` to the list of features to compile the example with WASI (required on the C example) and stub all the resulting WASI function if the runner is `host-wasmi`.
55
51
-`<PATH>` is the path to a wasm file
56
52
-`<func>` is the exported function to call in the wasm file, with `<args>` as arguments
57
53
@@ -65,16 +61,16 @@ Where:
65
61
66
62
```sh
67
63
cargo run -- rust # compile and run the Rust example
64
+
cargo run --features wasi -- rust # compile and run the Rust example with WASI (stubbed)
68
65
cargo run -- zig # compile and run the Zig example
69
-
# TODO irrelevant until next PR is merged
70
-
# NOTE: this needs the abi_wasi feature, because the wasi functions are not stubbed. See the 'Tips' section to learn more.
71
-
cargo run -- c # compile and run the C example
66
+
# NOTE: this needs the wasi feature, as `emcc` only compiles in WASI.
67
+
cargo run --features wasi -- c # compile and run the C example
72
68
cargo run -- -i MY_WASM_FILE.wasm MY_FUNCTION arg1 arg2
73
69
```
74
70
75
71
### Tips
76
72
77
-
-If the runner complains about missing definition for `wasi_snapshot_preview1` functions, try running your `.wasm` through [wasi-stub](./wasi-stub/). It stubs all wasi function in your wasm, so don't expect print or read_file to work anymore.
73
+
-`host-wasmi` does not support running with WASI, and will stuball WASI functions instead.
"for testing rust or zig, you must enable one feature in [abi_unknown, abi_wasi]"
91
-
)
92
-
}
93
84
"-i" | "--input" => {
94
-
#[cfg(feature = "abi_wasi")]
95
-
println!("The feature abi_wasi is enabled but the file tested is provided by you.\nThis feature influence how the examples are built, they have no effect here.");
0 commit comments