I've been looking a the WebAssembly website and tutorials and I feel a bit lost.
I have the following C code :
void EMSCRIPTEN_KEEPALIVE hello(char * value){
printf("%s\n", value);
}
I compiled it with (I'm also not sure this part is the best way to go) :
emcc demo.c -s WASM=1 -s NO_EXIT_RUNTIME=1 -o demo.js
From what I understand I can now use the demo.js glue code in my javascript class and call the method that way :
...
<script src="demo.js"></script>
<script>
function hello(){
// Get the value
var value = document.getElementById("sample");
_hello(value.innerHTML);
}
</script>
...
What I see being printed in the console when I call the method is :
(null)
Is there something I'm missing to pass a string value to C code compiled with WebAssembly ?
Thanks a lot