Skip to content

Commit 5c4f47a

Browse files
committed
put the funciton in the wrong spot
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent 53b218f commit 5c4f47a

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

src/hyperlight_wasm_runtime/src/module.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,24 +155,25 @@ fn init_wasm_runtime(function_call: FunctionCall) -> Result<Vec<u8>> {
155155
.map_err(|e| wasmtime::Error::msg(format!("{:?}", e)))
156156
},
157157
)?;
158-
159-
// Always register HostPrint
160-
let host_print_def = hostfuncs::HostFunctionDefinition {
161-
function_name: "HostPrint".to_string(),
162-
parameter_types: Some(alloc::vec![ParameterType::String]),
163-
return_type: ReturnType::Int,
164-
};
165-
let captured = host_print_def.clone();
166-
linker.func_new(
167-
"env",
168-
"HostPrint",
169-
hostfuncs::hostfunc_type(&host_print_def, &engine)?,
170-
move |c, ps, rs| {
171-
hostfuncs::call(&captured, c, ps, rs)
172-
.map_err(|e| wasmtime::Error::msg(format!("{:?}", e)))
173-
},
174-
)?;
175158
}
159+
160+
161+
let host_print_def = hostfuncs::HostFunctionDefinition {
162+
function_name: "HostPrint".to_string(),
163+
parameter_types: Some(alloc::vec![ParameterType::String]),
164+
return_type: ReturnType::Int,
165+
};
166+
let captured = host_print_def.clone();
167+
linker.func_new(
168+
"env",
169+
"HostPrint",
170+
hostfuncs::hostfunc_type(&host_print_def, &engine)?,
171+
move |c, ps, rs| {
172+
hostfuncs::call(&captured, c, ps, rs)
173+
.map_err(|e| wasmtime::Error::msg(format!("{:?}", e)))
174+
},
175+
)?;
176+
176177
*CUR_ENGINE.lock() = Some(engine);
177178
*CUR_LINKER.lock() = Some(linker);
178179
Ok(get_flatbuffer_result::<i32>(0))

0 commit comments

Comments
 (0)