Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions wasm2c/wasm-rt-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,26 @@ extern WASM_RT_THREAD_LOCAL uint32_t wasm_rt_saved_call_stack_depth;
* // Call the potentially-trapping function.
* my_wasm_func();
* ```
*
* This macro depends on definitions from `wasm-rt-impl.h`, e.g.:
* ```
* ...
* #include "wasm-rt-exceptions.h"
* ...
* ```
*
* In case the exception extension is not available one can use wasm_rt_try
* like in this example:
*
* ```
* 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));
* }
* ```
*/
#define wasm_rt_impl_try() \
(WASM_RT_SAVE_STACK_DEPTH(), wasm_rt_set_unwind_target(&g_wasm_rt_jmp_buf), \
Expand Down
Loading