mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-17 10:51:21 +00:00
kwasm imports
This commit is contained in:
@ -449,10 +449,17 @@ fn import_functions(
|
||||
});
|
||||
}
|
||||
None => {
|
||||
link_errors.push(LinkError::ImportNotFound {
|
||||
namespace: namespace.to_string(),
|
||||
name: name.to_string(),
|
||||
});
|
||||
if imports.allow_missing_functions {
|
||||
functions.push(vm::ImportedFunc {
|
||||
func: ::std::ptr::null(),
|
||||
vmctx: ::std::ptr::null_mut(),
|
||||
});
|
||||
} else {
|
||||
link_errors.push(LinkError::ImportNotFound {
|
||||
namespace: namespace.to_string(),
|
||||
name: name.to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ impl IsExport for Export {
|
||||
pub struct ImportObject {
|
||||
map: Rc<RefCell<HashMap<String, Box<dyn LikeNamespace>>>>,
|
||||
state_creator: Option<Rc<Fn() -> (*mut c_void, fn(*mut c_void))>>,
|
||||
pub allow_missing_functions: bool,
|
||||
}
|
||||
|
||||
impl ImportObject {
|
||||
@ -55,6 +56,7 @@ impl ImportObject {
|
||||
Self {
|
||||
map: Rc::new(RefCell::new(HashMap::new())),
|
||||
state_creator: None,
|
||||
allow_missing_functions: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +67,7 @@ impl ImportObject {
|
||||
Self {
|
||||
map: Rc::new(RefCell::new(HashMap::new())),
|
||||
state_creator: Some(Rc::new(state_creator)),
|
||||
allow_missing_functions: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,6 +119,7 @@ impl ImportObject {
|
||||
Self {
|
||||
map: Rc::clone(&self.map),
|
||||
state_creator: self.state_creator.clone(),
|
||||
allow_missing_functions: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user