Skip to content

Commit 18c4ec8

Browse files
Add wasmtime invoke to the C docs
Signed-off-by: Kate Goldenring <kgoldenr@akamai.com>
1 parent 6928e63 commit 18c4ec8

File tree

1 file changed

+17
-2
lines changed
  • component-model/src/language-support/building-a-simple-component

1 file changed

+17
-2
lines changed

component-model/src/language-support/building-a-simple-component/c.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,22 @@ world root {
302302
...
303303
```
304304

305-
## 6. Run the component from the example C host
305+
## 6. Run the component with `wasmtime --invoke`
306+
307+
If you want to quickly run the `add` export without writing a host application that embeds Wasmtime,
308+
you can invoke it directly with the Wasmtime CLI.
309+
310+
```console
311+
wasmtime run --invoke 'add(2, 2)' adder.wasm
312+
```
313+
314+
Depending on your Wasmtime version, the shorthand form may also work:
315+
316+
```console
317+
wasmtime --invoke 'add(2,2)' adder.wasm
318+
```
319+
320+
## 7. Run the component from the example C host
306321

307322
This repository includes a C application that can execute components that implement the add interface. This application embeds Wasmtime using the Wasmtime C API:
308323
`component-model/examples/example-c-host/host.c`.
@@ -367,7 +382,7 @@ Instead of installing the Wasmtime C API, you can use the provided Dockerfile wh
367382
From `component-model/examples/example-c-host`:
368383

369384
```console
370-
cp ../../examples/example-host/add.wasm ./add.wasm
385+
cp ../../examples/example-host/add.wasm ./adder.wasm
371386

372387
docker build \
373388
-f Dockerfile.host \

0 commit comments

Comments
 (0)