You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: component-model/src/language-support/building-a-simple-component/c.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -302,7 +302,22 @@ world root {
302
302
...
303
303
```
304
304
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
306
321
307
322
This repository includes a C application that can execute components that implement the add interface. This application embeds Wasmtime using the Wasmtime C API:
308
323
`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
0 commit comments