emscripten-core / emscripten-core/emscripten
TypeError: WebAssembly.instantiate(): Import #2 module="GOT.mem": module is not an object or function
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
My code:
```
#ifdef __EMSCRIPTEN__
#include
#endif
#ifdef __cplusplus
extern "C" {
#endif
int value = 0;
EMSCRIPTEN_KEEPALIVE
int Increment() { return value++; }
EMSCRIPTEN_KEEPALIVE
int Decrement() { return value--; }
#ifdef __cplusplus
}
#endif
```
Connect with:
```
const moduleMemory = new WebAssembly.Memory({initial: 256})
const importedObject = {
env: {
__memory_base: 0,
memory: moduleMemory,
},
}
WebAssembly.instantiateStreaming(fetch("state.wasm"), importedObject).then(result => {
moduleExports = result.instance.exports
})
```
I use the command:
`emcc state.cpp -s SIDE_MODULE=1 -O1 -o state.wasm`
And I get error Import #2 module="GOT.mem": module is not an object or function
When I use the command
`emcc state.cpp -o state.js`
And when I delete the state.js file and use only state.wasm, everything works fine
Contributor guide
Assessment
This issue has not been assessed yet.