mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 19:26:43 +01:00
add platform module providing implementation of random functions
This commit is contained in:
@@ -61,6 +61,8 @@ fn main() -> Result<()> {
|
||||
|
||||
let mut loader = Loader::new(&engine)?;
|
||||
|
||||
let platform_module = wasmtime::Module::new(&engine, include_bytes!("../platform/platform.wasm"))?;
|
||||
|
||||
let module = wasmtime::Module::new(&engine, loader.load(&uw8_module)?)?;
|
||||
|
||||
let mut store = wasmtime::Store::new(&engine, ());
|
||||
@@ -93,6 +95,12 @@ fn main() -> Result<()> {
|
||||
)?;
|
||||
}
|
||||
|
||||
let platform_instance = linker.instantiate(&mut store, &platform_module)?;
|
||||
|
||||
for export in platform_instance.exports(&mut store) {
|
||||
linker.define("env", export.name(), export.into_func().expect("platform surely only exports functions"))?;
|
||||
}
|
||||
|
||||
let instance = linker.instantiate(&mut store, &module)?;
|
||||
let tic = instance.get_typed_func::<i32, (), _>(&mut store, "tic")?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user