Hi, I want to use shared memory for my WebAssembly module. It's needed for js-dos. Currently emulation works in worker and frame updates are send using postMessage. I want to use SharedArrayBuffer to avoid copying/sending big rgba data.
I dont' need to use pthread or threading, I just want to share memory between worker and main process. How I can say emscripten to generate "shared" memory imort.
As suggested I tried wasm2wat and then wat2wasm, but it not working for me. Looks like it affects -s INVOKE_RUN=0, because after wasm2wat my module immediately starts and I can't provide own memory.
Without wasm2wat I have this error:
LinkError: WebAssembly.instantiate(): mismatch in shared state of memory, declared = 0, imported = 1
After wasm2wat this:
LinkError: WebAssembly.instantiate(): mismatch in shared state of memory, declared = 1, imported = 0
Can we add some pass to binaryen for turning non-shared memory into shared?