externalize mem

This commit is contained in:
NikVolf
2017-12-26 16:03:59 +03:00
parent 7590216161
commit 06219aa6e2
2 changed files with 10 additions and 1 deletions
+9
View File
@@ -1,4 +1,5 @@
use parity_wasm::{elements, builder};
use optimizer::import_section;
type Insertion = (usize, u32, u32, String);
@@ -37,6 +38,14 @@ pub fn externalize_mem(mut module: elements::Module) -> elements::Module {
.pop()
.expect("Own memory entry to exist in memory section");
import_section(&mut module).expect("Import section to exist").entries_mut().push(
elements::ImportEntry::new(
"env".to_owned(),
"memory".to_owned(),
elements::External::Memory(entry),
)
);
module
}