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

null references to functions #193

Open
sjamesr opened this issue Nov 26, 2024 · 1 comment
Open

null references to functions #193

sjamesr opened this issue Nov 26, 2024 · 1 comment

Comments

@sjamesr
Copy link

sjamesr commented Nov 26, 2024

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)

@rossberg
Copy link
Member

You should be able to simply use a C/C++ NULL as the C-side representation of a null reference.

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

2 participants