Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm2c] catching traps without exception runtime #2427

Open
whirlicote opened this issue May 30, 2024 · 0 comments
Open

[wasm2c] catching traps without exception runtime #2427

whirlicote opened this issue May 30, 2024 · 0 comments

Comments

@whirlicote
Copy link

I was trying out wasm_rt_impl_try from the wasm-rt-impl.h header when I got the following error:

src/wasm-rt-impl.h:59:32: error: 'wasm_rt_set_unwind_target' was not declared in this scope
   59 |   (WASM_RT_SAVE_STACK_DEPTH(), wasm_rt_set_unwind_target(&g_wasm_rt_jmp_buf), \
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~
src/gdexample.cpp:110:25: note: in expansion of macro 'wasm_rt_impl_try'
  110 |   wasm_rt_trap_t code = wasm_rt_impl_try();
      |                         ^~~~~~~~~~~~~~~~

Perhaps there is a missing include in wasm-rt-impl.h,

...
#include "wasm-rt-exceptions.h"
...

or perhaps the sample in my code needs to be adapted to something like this?

wasm_rt_trap_t code = wasm_rt_try(g_wasm_rt_jmp_buf);
if (WASM_RT_TRAP_NONE == code) {
  w2c_0x24empty(&my_module);
}
else {
  printf("%s\n", wasm_rt_strerror(code));
}

I would like to avoid explicitly including the exception handling runtime header since my WebAssembly module is not using the exceptions handling extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant