emscripten-core / emscripten-core/emscripten
can't import memory when load my binary file
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Please include the following in your bug report:
**Version of emscripten/emsdk:**
3.0.1
**Failing command line in full:**
emcc add.c -o add.js -O3 -s EXPORTED_FUNCTIONS=_add
**js code**
```
var module1, module2;
var importObj1 = {
env: {
memory: new WebAssembly.Memory({initial: 1, maximum: 10}),
}
}
fetch('add.wasm').then(response =>
response.arrayBuffer()
).then(bytes => {
WebAssembly.instantiate(bytes,importObj1).then(
res=>{
module1 = res.module;
console.log("module1 from instantiate:",module1);
}
)
return WebAssembly.compile(bytes)
}
).then(module => {
module2 = module;
console.log("module2 from compile:", module2)
});
```
unexpected result:
i set memory in importObj1 but it doesn't work, and the exported function get unexpected name"b" or "c" instead of add. what shoud i do for this?
Contributor guide
Assessment
This issue has not been assessed yet.