Skip to content

Commit d5845f4

Browse files
committed
f
1 parent dd92bbb commit d5845f4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

bindings/rust/src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ unsafe extern "C" fn host_callback(
170170
unimplemented!()
171171
}
172172

173-
fn create_function_import_list(host_functions: &[HostFunction]) -> Vec<sys::FizzyImportedFunction> {
173+
fn create_function_import_list(host_functions: &[&HostFunction]) -> Vec<sys::FizzyImportedFunction> {
174174
assert!(host_functions.len() == 1);
175175
let host_function = &host_functions[0];
176176
let fn_type = sys::FizzyFunctionType {
@@ -183,8 +183,8 @@ fn create_function_import_list(host_functions: &[HostFunction]) -> Vec<sys::Fizz
183183
function: Some(host_callback),
184184
context: std::ptr::null_mut(),
185185
};
186-
print!(
187-
"{:?} {:?}",
186+
println!(
187+
"mod:{:?} name:{:?}",
188188
host_function.module.as_bytes_with_nul(),
189189
host_function.name.as_bytes_with_nul()
190190
);
@@ -208,8 +208,11 @@ impl Module {
208208
output: sys::FizzyValueTypeVoid,
209209
index: 0,
210210
};
211-
let import_list = create_function_import_list(&[host_fn1]);
212-
println!("{:?} {}", import_list.as_ptr(), import_list.len());
211+
let import_list = vec![&host_fn1];
212+
let import_list = create_function_import_list(&import_list);
213+
println!("importlist: {:?} {}", import_list.as_ptr(), import_list.len());
214+
println!("{:?}", host_fn1.module); //unsafe { std::ffi::CStr::from_ptr(import_list[0].module) });
215+
println!("{:?}", unsafe { std::ffi::CStr::from_ptr(import_list[0].module) });
213216
let ptr = unsafe {
214217
sys::fizzy_resolve_instantiate(
215218
self.0,

0 commit comments

Comments
 (0)