@@ -16,7 +16,7 @@ if you're developing your own `.wit` files.
1616For WIT interfaces that are built in to WASI, the code is part of the
1717WebAssembly runtime that you will be using.
1818
19- C/C++ currently lacks an integrated toolchain like Rust's [ ` cargo-component ` ] [ cargo-component ] ).
19+ C/C++ currently lacks an integrated toolchain ( like Rust's [ ` cargo-component ` ] [ cargo-component ] ).
2020However, ` wit-bindgen ` can generate source-level bindings for
2121Rust, C, Java ([ TeaVM] ( https://teavm.org/ ) ), and [ TinyGo] ( https://tinygo.org/ ) ,
2222with the ability to add more language generators in the future.
@@ -30,6 +30,7 @@ with the ability to add more language generators in the future.
3030[ cargo-component ] : https://crates.io/crates/cargo-component
3131[ rust ] : https://www.rust-lang.org/learn/get-started
3232[ sample-wit ] : https://github.com/bytecodealliance/component-docs/blob/main/component-model/examples/tutorial/wit/adder/world.wit
33+ [ cargo-config ] : https://github.com/bytecodealliance/component-docs/blob/main/component-model/examples/example-host/Cargo.toml
3334
3435## 1. Download dependencies
3536
@@ -64,7 +65,7 @@ into a local file.
6465Then generate a C skeleton from ` wit-bindgen ` using this file:
6566
6667```
67- > wit-bindgen c path/to/adder/world.wit
68+ $ wit-bindgen c path/to/adder/world.wit
6869Generating "adder.c"
6970Generating "adder.h"
7071Generating "adder_component_type.o"
@@ -108,7 +109,7 @@ the initial version of the WASI APIs.
108109which introduced the component model.
109110
110111While in the past building a P2 component required conversion from a P1 component,
111- we can build a P2 component directly by using the `wasm32-wasip2-clang` binary
112+ we can now build a P2 component directly by using the `wasm32-wasip2-clang` binary
112113that was installed by the WASI SDK.
113114
114115If necessary, change `/opt/wasi-sdk` to the path where you installed
@@ -226,7 +227,8 @@ wasm-tools component new adder.wasm -o adder.component.wasm
226227### (optional) Build a WASI-enabled WebAssembly (P2) component with ` wasm-tools `
227228
228229Note that ` wasm-tools component new ` may fail if your code references any
229- [ WASI] [ wasi ] APIs that must be imported, for example via standard library imports like ` stdio.h ` .
230+ [ WASI] [ wasi ] APIs that must be imported:
231+ for example, via standard library imports like ` stdio.h ` .
230232
231233Using WASI interfaces requires an additional step,
232234as the WASI SDK still references WASI Preview 1 APIs (those with ` wasi_snapshot_preview1 ` in their names)
@@ -313,8 +315,11 @@ world root {
313315The following section requires you to have [ a Rust toolchain] [ rust ] installed.
314316
315317> [ !WARNING]
316- > You must be careful to use a version of the adapter (` wasi_snapshot_preview1.wasm ` ) that is compatible with the version of
317- > ` wasmtime ` that will be used, to ensure that WASI interface versions (and relevant implementation) match.
318+ > You must be careful to use a version of the adapter (` wasi_snapshot_preview1.wasm ` )
319+ > that is compatible with the version of ` wasmtime ` that will be used,
320+ > to ensure that WASI interface versions (and relevant implementation) match.
321+ > (The ` wasmtime ` version is specified in [ the Cargo configuration file] [ cargo-config ]
322+ > for the example host.)
318323
319324This repository contains an [ example WebAssembly host] [ example-host ] written in Rust
320325that can run components that implement the ` adder ` world.
@@ -371,7 +376,7 @@ This kind of error normally indicates that the host in question does not satisfy
371376
372377It is not yet possible to run a WebAssembly Component using the ` wasmtime ` C API.
373378See [ ` wasmtime ` issue #6987 ] ( https://github.com/bytecodealliance/wasmtime/issues/6987 ) for more details.
374- The c-api is preferred over directly using the example host Rust crate in C++.
379+ The C API is preferred over directly using the example host Rust crate in C++.
375380
376381However, C/C++ language guest components can be composed with components written in any other language
377382and run by their toolchains,
0 commit comments