wasm-c-api
wasm-c-api copied to clipboard
null references to functions
Hi all,
Is there a way to create a dangling funcref using the C API? We can create non-null references by using wasm_func_as_ref, but I don't see any way to create a null funcref.
I'm trying to implement a spec test runner that can run the following test:
(assert_return (invoke "select-funcref" (ref.null func) (ref.null func) (i32.const 1)) (ref.null func))
I need to be able to take those (ref.null func) literals and turn them into wasm_val_t representing a null pointer to function. Is there any way to do this in the current API? If not, can we add a function such as wasm_func_null_ref that returns one?
(see the original test)
You should be able to simply use a C/C++ NULL as the C-side representation of a null reference.