Passing a JS ArrayBuffer or TypedArray to Emscripten w/o Copying Passing a JS ArrayBuffer or TypedArray to Emscripten w/o Copying javascript javascript

Passing a JS ArrayBuffer or TypedArray to Emscripten w/o Copying


Answering myself.
As it currently stands, there is no way to allow the emscriptened C/C++ code to access JS allocated memory buffers.

That being said, buffers allocated via Module._malloc() can be passed "by pointer" when using the C API.

Embinding will add additional copying into the C++ types.

For more info see this thread on the emscripten mailing list.