Skip to content

Commit dc7a784

Browse files
committed
Minor fixes
1 parent 5bceb22 commit dc7a784

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

  • component-model/src/language-support

component-model/src/language-support/c.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if you're developing your own `.wit` files.
1616
For WIT interfaces that are built in to WASI, the code is part of the
1717
WebAssembly 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]).
2020
However, `wit-bindgen` can generate source-level bindings for
2121
Rust, C, Java ([TeaVM](https://teavm.org/)), and [TinyGo](https://tinygo.org/),
2222
with 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.
6465
Then 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
6869
Generating "adder.c"
6970
Generating "adder.h"
7071
Generating "adder_component_type.o"
@@ -108,7 +109,7 @@ the initial version of the WASI APIs.
108109
which introduced the component model.
109110
110111
While 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
112113
that was installed by the WASI SDK.
113114
114115
If 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

228229
Note 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

231233
Using WASI interfaces requires an additional step,
232234
as the WASI SDK still references WASI Preview 1 APIs (those with `wasi_snapshot_preview1` in their names)
@@ -313,8 +315,11 @@ world root {
313315
The 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
319324
This repository contains an [example WebAssembly host][example-host] written in Rust
320325
that 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

372377
It is not yet possible to run a WebAssembly Component using the `wasmtime` C API.
373378
See [`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

376381
However, C/C++ language guest components can be composed with components written in any other language
377382
and run by their toolchains,

0 commit comments

Comments
 (0)