emscripten-core / emscripten-core/emscripten

Access a Modules WebAssembly.Table and WebAssembly.Memory

Open
#14,326 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I need to call a function by its index in the `WebAssembly.Table`. How can I access the table of a module?

The same goes for memory, how can I get a reference to `WebAssembly.Memory`?
I know that I can explecitly passs `Module['wasmMemory']` when creating the module and then the emscripten generated js will use this as memory. But I don't want to create the memory on my own since I don't know the settings that were used when the module was compiled. Rather I want the emscripten generated js to create the memory and then access it.
I currently use `Module['HEAP8']` to access the buffer. Is this safe?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.