Side Module in AssemblyScript?

19 views
Skip to first unread message

キャロウ マーク

unread,
Aug 5, 2020, 4:11:05 PM8/5/20
to emscripten-discuss
Is it possible to create something like a Side Module (i.e. like a dll) written in AssemblyScript that could share the HEAP with emscripten compiled wasm code?

If not possible now, is this something that could be supported with changes to Emscripten or AssemblyScript?

Regards

-Mark
signature.asc

Sam Clegg

unread,
Aug 5, 2020, 5:48:56 PM8/5/20
to emscripte...@googlegroups.com
Sounds like an interesting project!

I'm not sure you would need any help from emscripten to try and do this kind of thing.

You can access the WebAssembly module's memory from JavaScript via `Module['memory']` and then do whatever you want to it including passing it your AssemblyScript.

The tricky part is how you manage memory within this shared heap.   At the very least you would want to tell AssemblyScript about the limits of the heap, and maybe even pass the emscripten modules `malloc` and `free` functions over so it can coordinate with emscripten-compiled code.  


--
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 emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/DF23CB4C-7719-4C4C-8749-8E9D220BA1C1%40callow.im.

キャロウ マーク

unread,
Aug 5, 2020, 6:41:05 PM8/5/20
to emscripten-discuss


On Aug 5, 2020, at 14:48, 'Sam Clegg' via emscripten-discuss <emscripte...@googlegroups.com> wrote:

The tricky part is how you manage memory within this shared heap.   At the very least you would want to tell AssemblyScript about the limits of the heap, and maybe even pass the emscripten modules `malloc` and `free` functions over so it can coordinate with emscripten-compiled code.

Thanks for your answer. Getting both to use the same malloc and free functions sounds like the right way to go rather than trying to keep 2 different mallocs from stepping on each other. I wonder if it is possible…

Regards

    -Mark

signature.asc
Reply all
Reply to author
Forward
0 new messages