Skip to content

Commit 6afe020

Browse files
committed
running.md moved to wasmtime.md section and updated for custom invocations
1 parent 65a4f09 commit 6afe020

5 files changed

Lines changed: 13 additions & 36 deletions

File tree

component-model/src/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
- [Creating and Consuming Components](./creating-and-consuming.md)
2626
- [Authoring Components](./creating-and-consuming/authoring.md)
2727
- [Composing Components](./creating-and-consuming/composing.md)
28-
- [Running Components](./creating-and-consuming/running.md)
2928
- [Distributing and Fetching Components and WIT](./creating-and-consuming/distributing.md)
3029
- [Tutorial](./tutorial.md)
3130

component-model/src/creating-and-consuming/running.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

component-model/src/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ The WebAssembly Component Model is a broad-reaching architecture for building in
55
| Understanding components | Building components | Using components |
66
|--------------------------|----------------------|-------------------|
77
| [Why Components?] | [C/C++] | [Composing] |
8-
| [Components] | [C#] | [Running] |
9-
| [Interfaces] | [Go] | [Distributing] |
8+
| [Components] | [C#] | [Distributing] |
9+
| [Interfaces] | [Go] | |
1010
| [Worlds] | [JavaScript] | |
1111
| | [Python] | |
1212
| | [Rust] | |

component-model/src/language-support.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,4 @@ working with WebAssembly modules and components.
8989
You can "run" a component by calling one of its exports. Hosts and runtimes often only support
9090
running components with certain exports. The [`wasmtime`](https://github.com/bytecodealliance/wasmtime) CLI can only run "command" components, so in
9191
order to run the `add` function above, it first must be composed with a primary "command" component
92-
that calls it. See [documentation on running components](./creating-and-consuming/running.md) for
93-
more details.
92+
that calls it. See [documentation on running components](./runtimes/wasmtime.md) for more details.

component-model/src/runtimes/wasmtime.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,13 @@ Try out building and running HTTP components with one of these tutorials
2727
1. [Hello WASI HTTP tutorial](https://github.com/sunfishcode/hello-wasi-http) - build and serve a simple Rust-based HTTP component
2828

2929
2. [HTTP Auth Middleware tutorial](https://github.com/fermyon/http-auth-middleware#running-with-wasmtime) - compose a HTTP authentication middleware component with a business logic component
30+
31+
## Running components with custom exports
32+
As of Wasmtime Version 33.0.0, there is [support for invoking custom component exports](https://bytecodealliance.org/articles/invoking-component-functions-in-wasmtime-cli).
33+
34+
35+
As an example, if your component exports a function `add` which takes two numeric arguments, you can make use of this feature with the following command.
36+
37+
`wasmtime run --invoke 'foo(1, 2)' <path-to-wasm-file>`
38+
39+
Make sure to wrap your invocation in single quotes abd to include parentheses, even if your function doesn't take any arguments. For a full list of ways to represent the various wit types when passing arguments to your exported function, visit the [WAVE repo](https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-wave).

0 commit comments

Comments
 (0)