Skip to content

Commit 340d936

Browse files
authored
docs: document C API setup for WASIp2 and wasi:http (#12979)
1 parent 42d271b commit 340d936

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

docs/WASI-api.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
11
# WASI API
22

3-
Development of the WASI API has now moved to the WASI CG Subgroup; see
4-
the [github repository], including the [API documentation].
3+
Development of WASI has moved to the WASI CG Subgroup; see the
4+
[WASI repository] and the [interfaces page on wasi.dev].
55

6-
[github repository]: https://github.com/WebAssembly/WASI/
7-
[API documentation]: https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md
6+
For Wasmtime embedders using the C API with the component model:
7+
8+
* Add core WASI imports to your component linker with
9+
[`wasmtime_component_linker_add_wasip2`].
10+
* If your component imports `wasi:http`, also add
11+
[`wasmtime_component_linker_add_wasi_http`].
12+
* Configure store-local WASI state with [`wasmtime_context_set_wasi`], and
13+
initialize WASI HTTP with [`wasmtime_context_set_wasi_http`] (after WASI).
14+
15+
See these headers for current signatures and feature-gating details:
16+
17+
* [`wasmtime/component/linker.h`]
18+
* [`wasmtime/store.h`]
19+
20+
For legacy preview1 documentation, see the [preview1 docs].
21+
22+
[WASI repository]: https://github.com/WebAssembly/wasi
23+
[interfaces page on wasi.dev]: https://wasi.dev/interfaces
24+
[`wasmtime_component_linker_add_wasip2`]: https://github.com/bytecodealliance/wasmtime/blob/main/crates/c-api/include/wasmtime/component/linker.h
25+
[`wasmtime_component_linker_add_wasi_http`]: https://github.com/bytecodealliance/wasmtime/blob/main/crates/c-api/include/wasmtime/component/linker.h
26+
[`wasmtime_context_set_wasi`]: https://github.com/bytecodealliance/wasmtime/blob/main/crates/c-api/include/wasmtime/store.h
27+
[`wasmtime_context_set_wasi_http`]: https://github.com/bytecodealliance/wasmtime/blob/main/crates/c-api/include/wasmtime/store.h
28+
[`wasmtime/component/linker.h`]: https://github.com/bytecodealliance/wasmtime/blob/main/crates/c-api/include/wasmtime/component/linker.h
29+
[`wasmtime/store.h`]: https://github.com/bytecodealliance/wasmtime/blob/main/crates/c-api/include/wasmtime/store.h
30+
[preview1 docs]: https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md

0 commit comments

Comments
 (0)