"fix stuff lol"
This commit is contained in:
+13
-2
@@ -1,4 +1,5 @@
|
||||
mod gyehoek;
|
||||
mod internal;
|
||||
|
||||
use std::io;
|
||||
use std::io::Read;
|
||||
@@ -21,12 +22,22 @@ fn read<R : Read> (mut rdr : R) -> io::Result<Vec<u8>> {
|
||||
Ok (buf)
|
||||
}
|
||||
|
||||
fn get_config () -> Config {
|
||||
let mut cfg = Config::new ();
|
||||
cfg.wasm_reference_types (true);
|
||||
cfg.wasm_function_references (true);
|
||||
cfg.wasm_tail_call (true);
|
||||
cfg.wasm_gc (true);
|
||||
cfg
|
||||
}
|
||||
|
||||
pub fn main () -> wasmtime::Result<()> {
|
||||
let args = Args::parse ();
|
||||
let engine = Engine::default ();
|
||||
let wasm_config = get_config ();
|
||||
let engine = Engine::new (&wasm_config)?;
|
||||
let module = Module::new (&engine, read (args.wasm)?)?;
|
||||
let mut linker = Linker::new (&engine);
|
||||
linker.func_wrap ("gyehoek", "say-hi", gyehoek::say_hi)?;
|
||||
linker.func_wrap ("gyehoek", "write", gyehoek::write)?;
|
||||
let mut store : Store<u32> = Store::new (&engine, 4);
|
||||
let instance = linker.instantiate (&mut store, &module)?;
|
||||
let main = instance.get_typed_func::<(),()> (&mut store, "main")?;
|
||||
|
||||
Reference in New Issue
Block a user