Re:Recommendations when publishing a WASM library
by jitl on Monday March 28, 2022 @10:01AM
(#30830554)
You are assuming wrong, this is Blazor’s JS support library. By “default” WebAssembly has nothing outside the WASM bytecode, not even memory/allocator. It’s up to the host environment to provide the WASM module a Memory and whatever “imports” it needs.
Re:Recommendations when publishing a WASM library
by klibertp on Monday March 28, 2022 @12:50PM
(#30832561)
Memory can also be statically reserved in a binary, like the .data section in x86 asm. IIRC (tell me if I'm very wrong) Emscripten malloc works by reserving a large buffer up front and then managing pointers to (parts of) it. Otherwise, you can allocate memory buffer dynamically from JS[1] and pass the pointer to it to the WASM. Obviously, you can do this in response to the request coming from WASM, but you don't have to.
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
I'm still new to WASM, but I assume this functionality is part of the WASM runtime? (As opposed to a hook that's part of the Javascript part of Blazor?)