From: Brendan Hansen Date: Mon, 23 Oct 2023 14:44:37 +0000 (-0500) Subject: fixed: dyncallback problems X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=bfebf5cb082d95af018ce8a867dabac352e880b3;p=onyx.git fixed: dyncallback problems --- diff --git a/compiler/src/wasm_runtime.c b/compiler/src/wasm_runtime.c index 9e4b221f..cb68f7cd 100644 --- a/compiler/src/wasm_runtime.c +++ b/compiler/src/wasm_runtime.c @@ -308,7 +308,7 @@ typedef struct DynCallbackContext { static DCsigchar __wasm_dyncallback(DCCallback *cb, DCArgs *args, DCValue *result, void *userdata) { DynCallbackContext *ctx = userdata; - int arg_count = bh_str_last_index_of(ctx->sig, ')'); + int arg_count = bh_str_last_index_of(ctx->sig, ')') - 1; wasm_val_vec_t wasm_args; wasm_val_vec_new_uninitialized(&wasm_args, arg_count); diff --git a/shared/include/onyx_library.h b/shared/include/onyx_library.h index 8b0d26ad..f0046724 100644 --- a/shared/include/onyx_library.h +++ b/shared/include/onyx_library.h @@ -19,7 +19,6 @@ typedef struct OnyxRuntime { wasm_memory_t* wasm_memory; wasm_engine_t *wasm_engine; wasm_extern_vec_t wasm_imports; - wasm_table_t *wasm_func_table; int argc; char **argv; @@ -39,6 +38,7 @@ typedef struct OnyxRuntime { // This is only set when using the OVMwasm runtime, as Wasmer's C-api does not allow // for this function to exist, yet. + wasm_table_t *wasm_func_table; void (*(*wasm_func_from_idx)(wasm_table_t *table, unsigned int index, char *signature))(void); } OnyxRuntime;