https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-views
 talks about memory views but leaves much unsaid. Where can I find complete 
documentation? I’m looking for information about all the possible arguments to 
the constructor in usage such as

            std::vector<uint8_t> bytes{};
            bytes.resize(data["byteLength"].as<size_t>());
            emscripten::val memory = 
emscripten::val::module_property("HEAP8")["buffer"];
            emscripten::val memoryView = data["constructor"].new_(memory, 
reinterpret_cast<uintptr_t>(bytes.data()), data["length"].as<uint32_t>());
            memoryView.call<void>("set", data);

(This usage isn’t even mentioned on the referenced page.)

In particular I want to know if there is a way to give an offset to either the 
view constructor or the set method so that “data” gets copied into just part of 
the bytes vector.

I also want to know how in usage such as

            std::vector<uint8_t> cDst;
            cDst.resize(bytes_per_slice);

            /* Write data to cDst vector …. */

           return val(typed_memory_view(cDst.size(), cDst.data());

the receiver in JS can delete the data when done with it.

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/03FEFE9B-5C50-4A5D-A4FE-9B22CBF4EFA2%40callow.im.

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to