diff options
Diffstat (limited to 'wasm2c/examples/callback/main.c')
-rw-r--r-- | wasm2c/examples/callback/main.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/wasm2c/examples/callback/main.c b/wasm2c/examples/callback/main.c index b0b37d46..8c6f9db0 100644 --- a/wasm2c/examples/callback/main.c +++ b/wasm2c/examples/callback/main.c @@ -6,8 +6,8 @@ * The callback function. Prints the null-terminated string at the given * location in the instance's exported memory. */ -void print(Z_callback_instance_t* instance, uint32_t ptr) { - puts(Z_callbackZ_memory(instance)->data + ptr); +void print(w2c_callback* instance, uint32_t ptr) { + puts(w2c_callback_memory(instance)->data + ptr); } int main(int argc, char** argv) { @@ -15,8 +15,8 @@ int main(int argc, char** argv) { wasm_rt_init(); /* Instantiate the callback module. */ - Z_callback_instance_t inst; - Z_callback_instantiate(&inst); + w2c_callback inst; + wasm2c_callback_instantiate(&inst); /* * Call the module's "set_print_function" function, which takes a funcref to @@ -24,15 +24,16 @@ int main(int argc, char** argv) { * looked up with "Z_callback_get_func_type"), a pointer to the function, and * a module instance pointer that will be passed to the function when called. */ - wasm_rt_func_type_t fn_type = Z_callback_get_func_type(1, 0, WASM_RT_I32); + wasm_rt_func_type_t fn_type = + wasm2c_callback_get_func_type(1, 0, WASM_RT_I32); wasm_rt_funcref_t fn_ref = {fn_type, (wasm_rt_function_ptr_t)print, &inst}; - Z_callbackZ_set_print_function(&inst, fn_ref); + w2c_callback_set_print_function(&inst, fn_ref); /* "say_hello" uses the previously installed callback. */ - Z_callbackZ_say_hello(&inst); + w2c_callback_say_hello(&inst); /* Free the module instance and the Wasm runtime state. */ - Z_callback_free(&inst); + wasm2c_callback_free(&inst); wasm_rt_free(); return 0; |