Can anyone here explain, or point me at an example, of how to move large data, 
e.g an image, between JS memory and wasm memory using a function defined with 
WebIDL binder?

In embind for moving data from JS to wasm, I use an emscripten::val parameter 
to pass in the JS handle then emscripten::val::module_property to get a handle 
to the wasm memory on which I make a memory view to which the data is copied.

To move data from wasm to JS I use emscripten::val::get_typed_memory_view to 
create a view onto the item in wasm memory and return the view via a 
emscripten::val.

I tried to use emscripten::val with WebIDL binder but I could not get it to 
compile. There is a short section in the WebIDL docs "Pointers, References, 
Value types (Ref and Value)”, which is not very illuminating, but does suggest 
that emscripten::val is not the right way to move data with WebIDL binder.

I’d prefer to use WebIDL binder because in order to document my previous embind 
wrappers I ended up writing what looked very much like web IDL because it seems 
the best way to tie all the pieces together.

Regards

    -Mark


-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/005C24B2-1D79-47CC-A291-D7A6B749582F%40callow.im.

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to