Is is possible to use a typed array created on HEAP8 with XMLHttpRequest as the 
destination for the incoming data?

Regards

    -Mark

> On Jul 9, 2020, at 9:44, Alon Zakai <[email protected]> wrote:
> 
> HEAP8 is one of the global variables the emscripten JS always has. It's 
> always present for code in a JS library, --pre-js, or other code that is part 
> of the main JS output (that is all optimized together).
> 
> On Wed, Jul 8, 2020 at 6:39 PM キャロウ マーク <[email protected] 
> <mailto:[email protected]>> wrote:
> Thanks Alon.
> 
> > On Jul 8, 2020, at 15:59, Alon Zakai <[email protected] 
> > <mailto:[email protected]>> wrote:
> >
> > Embind and the WebIDL binder are separate tools. They don't have any 
> > special support for mixing between them.
> 
> That’s what I had concluded. Thanks for confirming. My confusion arose 
> because it is not clear (to me at least) that emscripten::val is strictly 
> part of embind.
> 
> >
> > The WebIDL binder doesn't have direct support for copying data from JS into 
> > wasm. You can do it manually though, without the WebIDL binder, by 
> > malloc()ing some room, copying the data (all in JS, just a copy from the JS 
> > data into HEAP8 for example), then you can pass the malloc()ed pointer as a 
> > parameter to the compiled code (with the WebIDL binder, passing it as a 
> > void* would work, or an int).
> 
> So in JS do I create a typed array view on the right place in HEAP8 and then 
> copy in and out of that? How does the JS find HEAP8? I need to create a 
> wrapper for the zstd decoder so I need to be as efficient as possible in 
> moving the data.
> 

-- 
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/66D3C2D4-C9C8-4665-85F2-0B8EAE8882C6%40callow.im.

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to