mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-17 06:51:24 +00:00
Add support for modules importing memory
The default of Rust wasm binaries is to export the memory that they contain, but LLD also supports an `--import-memory` option where memory is imported into a module instead. It's looking like importing memory is along the lines of how shared memory wasm modules will work (they'll all import the same memory). This commit adds support to wasm-bindgen to support modules which import memory. Memory accessors are tweaked to no longer always assume that the wasm module exports its memory. Additionally JS bindings will create a `memory` option automatically because LLD always imports memory from an `env` module which won't actually exist.
This commit is contained in:
@ -150,19 +150,6 @@ impl Output {
|
||||
if let Some(i) = self.module.import_section() {
|
||||
let mut set = HashSet::new();
|
||||
for entry in i.entries() {
|
||||
match *entry.external() {
|
||||
External::Function(_) => {}
|
||||
External::Table(_) => {
|
||||
bail!("wasm imports a table which isn't supported yet");
|
||||
}
|
||||
External::Memory(_) => {
|
||||
bail!("wasm imports memory which isn't supported yet");
|
||||
}
|
||||
External::Global(_) => {
|
||||
bail!("wasm imports globals which aren't supported yet");
|
||||
}
|
||||
}
|
||||
|
||||
if !set.insert(entry.module()) {
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user