-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: readme/tinygo examples use go:wasmexport/wasmimport, -buildmode=…
…c-shared Signed-off-by: Edoardo Vacchi <[email protected]>
- Loading branch information
Showing
4 changed files
with
34 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
## Reactor module example | ||
By including this package, you'll turn your plugin into a [Reactor](https://dylibso.com/blog/wasi-command-reactor/) module. This makes sure that you can use WASI (e.g. File Access) in your exported functions. | ||
By including this package, you'll turn your plugin into a [Reactor](https://dylibso.com/blog/wasi-command-reactor/) module. | ||
This makes sure that you can use WASI (e.g. File Access) in your exported functions. | ||
|
||
To test this example, run: | ||
This is only required for TinyGo versions below 0.34.0 where native support for reactort-style modules | ||
was missing.To test this example, run: | ||
|
||
```bash | ||
tinygo build -target wasi -o reactor.wasm .\tiny_main.go | ||
tinygo build -target wasi -o reactor.wasm ./tiny_main.go | ||
extism call ./reactor.wasm read_file --input "./test.txt" --allow-path . --wasi --log-level info | ||
# => Hello World! | ||
``` | ||
|
||
If you don't include the pacakge, you'll see this output: | ||
```bash | ||
extism call .\c.wasm read_file --input "./test.txt" --allow-path . --wasi --log-level info | ||
extism call ./c.wasm read_file --input "./test.txt" --allow-path . --wasi --log-level info | ||
# => 2024/01/18 20:48:48 open ./test.txt: errno 76 | ||
``` | ||
``` |