7 ms·
> you can pass integers and pointers around No, not even that (the second thing, passing pointers)! WASM has a different address space (starting from 0), effec
by wucke13 2y ago
> you can pass integers and pointers around
No, not even that (the second thing, passing pointers)! WASM has a different address space (starting from 0), effectively indexing into the WASM module's linear memory. A pointer/reference from the outside env can not be dereferenced from within the WASM bytecode.
The multiple linear memory proposal can circumvent this (allowing you to build something somewhat similar to a simple MMU/address translation engine), but language support for that feature is sparse (AFAIK, Rust does not expose any way to access a different than the default linear memory for example).
There is various hacks around it, but sharing memory block-wise between WASM and outside env is involved already.
- Philpax 2y agoYes, sorry, I should have clarified: pointers to the WASM memory, not host memory. You need to copy data into the memory in order to use it.