Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Apr 9, 2021
1 parent d5845f4 commit da649a6
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions bindings/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,17 @@ unsafe extern "C" fn host_callback(
context: *mut sys::FizzyExecutionContext,
) -> sys::FizzyExecutionResult {
println!("host fuction called!");
unimplemented!()
//unimplemented!()
sys::FizzyExecutionResult {
trapped: false,
has_value: false,
value: sys::FizzyValue { i32: 0 },
}
}

fn create_function_import_list(host_functions: &[&HostFunction]) -> Vec<sys::FizzyImportedFunction> {
fn create_function_import_list(
host_functions: &[&HostFunction],
) -> Vec<sys::FizzyImportedFunction> {
assert!(host_functions.len() == 1);
let host_function = &host_functions[0];
let fn_type = sys::FizzyFunctionType {
Expand All @@ -183,11 +190,6 @@ fn create_function_import_list(host_functions: &[&HostFunction]) -> Vec<sys::Fiz
function: Some(host_callback),
context: std::ptr::null_mut(),
};
println!(
"mod:{:?} name:{:?}",
host_function.module.as_bytes_with_nul(),
host_function.name.as_bytes_with_nul()
);
vec![sys::FizzyImportedFunction {
module: host_function.module.as_ptr(),
name: host_function.name.as_ptr(),
Expand All @@ -210,9 +212,6 @@ impl Module {
};
let import_list = vec![&host_fn1];
let import_list = create_function_import_list(&import_list);
println!("importlist: {:?} {}", import_list.as_ptr(), import_list.len());
println!("{:?}", host_fn1.module); //unsafe { std::ffi::CStr::from_ptr(import_list[0].module) });
println!("{:?}", unsafe { std::ffi::CStr::from_ptr(import_list[0].module) });
let ptr = unsafe {
sys::fizzy_resolve_instantiate(
self.0,
Expand Down

0 comments on commit da649a6

Please sign in to comment.