Using externref values and compilation from C to wasm

222 views
Skip to first unread message

Karl Werner

unread,
Oct 10, 2022, 11:56:34 AM10/10/22
to emscripten-discuss
Hello,
I am currently working on calling a wasm-module with wasmtime and use them in my code. So far I have written the modules first in C and then compile it to wasm with emscripten and I have just used int/floats as an input/output to the wasm-module. Now I would like to use externref values as input/output to the wasm-module as I need to pass more complex data structures to a wasm-module. (https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md

My goal is to have a C code which uses externref values and then returns a modified version of them. But I have problems to initialize and use externref values in the C code and then compile it to a wasm-module.

In the wasmtime documentation this wat file is given as an example. My goal is to create a similar wat file from a C code which has externref as input/output (param/result).

Screenshot from 2022-10-10 16-25-14.png(In this example the wasm-module just returns the given externref value and doesn't modify it)

Does anyone know how to solve this problem? Or where should I look for a possible solution?

I appreciate any help with it.

Thank you very much.
Karl

Reply all
Reply to author
Forward
0 new messages