Skip to content

Commit

Permalink
update linking example
Browse files Browse the repository at this point in the history
  • Loading branch information
pchickey committed Jan 29, 2021
1 parent 8ea42ab commit 2ad7565
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions examples/linking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
// You can execute this example with `cargo run --example linking`

use anyhow::Result;
use wasi_cap_std_sync::WasiCtxBuilder;
use wasmtime::*;
use wasmtime_wasi::{Wasi, WasiCtx};
use wasmtime_wasi::Wasi;

fn main() -> Result<()> {
let engine = Engine::default();
Expand All @@ -13,7 +14,13 @@ fn main() -> Result<()> {
// 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.
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)?;

// Load and compile our two modules
Expand Down

0 comments on commit 2ad7565

Please sign in to comment.