-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add examples of linking and WASI #1369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add examples of linking and WASI #1369
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great example! Can we mention this example in the book docs somewhere, so that people reading the book can easily discover it?
examples/linking.c
Outdated
wasm_byte_vec_t error; | ||
if (wasmtime_wat2wasm(engine, &wat, bytes, &error) == 0) { | ||
fprintf(stderr, "failed to parse wat %.*s\n", (int) error.size, error.data); | ||
exit(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should exit with a non-zero status.
This commit adds two example programs, one for linking two modules together and one for instantiating WASI. The linkage example additionally uses WASI to get some meaningful output at this time. cc bytecodealliance#1272
55b6820
to
be304e6
Compare
Good idea! I've added all the examples as pages to the book, @sunfishcode want to take another look? |
docs/embed-rust.md
Outdated
@@ -3,7 +3,7 @@ | |||
This document shows an example of how to embed Wasmtime using the [Rust | |||
API][apidoc] to execute a simple wasm program. Be sure to also check out the | |||
[full API documentation][apidoc] for a full listing of what the [`wasmtime` | |||
crate][crate] has to offer. | |||
crate][wasmtime] has to offer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to mention the examples here too, just to make sure people who skip ahead to the embedding chapter don't miss the examples that go along with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
This commit adds two example programs, one for linking two modules
together and one for instantiating WASI. The linkage example
additionally uses WASI to get some meaningful output at this time.
cc #1272