-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d846f1
commit b742c30
Showing
5 changed files
with
132 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This example shows how you can use the `wasmtime.loader` module to load wasm | ||
# components without having to generate bindings manually | ||
|
||
import wasmtime, wasmtime.loader | ||
|
||
import loader_component_add # type: ignore | ||
|
||
|
||
store = wasmtime.Store() | ||
component = loader_component_add.Root(store) | ||
assert component.add(store, 1, 2) == 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(component | ||
(core module $C | ||
(func (export "add") (param i32 i32) (result i32) | ||
local.get 0 | ||
local.get 1 | ||
i32.add) | ||
) | ||
(core instance $c (instantiate $C)) | ||
(core func $add (alias core export $c "add")) | ||
(func (export "add") (param "x" s32) (param "y" s32) (result s32) | ||
(canon lift (core func $add))) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters