update linking example
This commit is contained in:
@@ -3,8 +3,9 @@
|
|||||||
// You can execute this example with `cargo run --example linking`
|
// You can execute this example with `cargo run --example linking`
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
use wasi_cap_std_sync::WasiCtxBuilder;
|
||||||
use wasmtime::*;
|
use wasmtime::*;
|
||||||
use wasmtime_wasi::{Wasi, WasiCtx};
|
use wasmtime_wasi::Wasi;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let engine = Engine::default();
|
let engine = Engine::default();
|
||||||
@@ -13,7 +14,13 @@ fn main() -> Result<()> {
|
|||||||
// First set up our linker which is going to be linking modules together. We
|
// First set up our linker which is going to be linking modules together. We
|
||||||
// want our linker to have wasi available, so we set that up here as well.
|
// want our linker to have wasi available, so we set that up here as well.
|
||||||
let mut linker = Linker::new(&store);
|
let mut linker = Linker::new(&store);
|
||||||
let wasi = Wasi::new(&store, WasiCtx::new(std::env::args())?);
|
let wasi = Wasi::new(
|
||||||
|
&store,
|
||||||
|
WasiCtxBuilder::new()
|
||||||
|
.inherit_stdio()
|
||||||
|
.inherit_args()?
|
||||||
|
.build()?,
|
||||||
|
);
|
||||||
wasi.add_to_linker(&mut linker)?;
|
wasi.add_to_linker(&mut linker)?;
|
||||||
|
|
||||||
// Load and compile our two modules
|
// Load and compile our two modules
|
||||||
|
|||||||
Reference in New Issue
Block a user