mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
export the memory with the name "memory"
This commit is contained in:
parent
fac7e68b43
commit
87039232eb
@ -206,6 +206,9 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
|
|||||||
//stream.writeVaruint32( pages ); // maximum length
|
//stream.writeVaruint32( pages ); // maximum length
|
||||||
}
|
}
|
||||||
wasm.writeSection( SectionType.Memory, stream );
|
wasm.writeSection( SectionType.Memory, stream );
|
||||||
|
|
||||||
|
// export the memory with the name "memory"
|
||||||
|
exports.add( new ExportEntry( "memory", ExternalKind.Memory, 0 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public class TextModuleWriter extends ModuleWriter {
|
|||||||
int pages = (dataSize + 0xFFFF) / 0x10000;
|
int pages = (dataSize + 0xFFFF) / 0x10000;
|
||||||
newline( output );
|
newline( output );
|
||||||
String pagesStr = Integer.toString( pages );
|
String pagesStr = Integer.toString( pages );
|
||||||
output.append( "(memory " ).append( pagesStr ).append( ' ' ).append( pagesStr ).append( ')' );
|
output.append( "(memory (export \"memory\") " ).append( pagesStr ).append( ' ' ).append( pagesStr ).append( ')' );
|
||||||
newline( output );
|
newline( output );
|
||||||
output.append( "(data (i32.const 0) \"" );
|
output.append( "(data (i32.const 0) \"" );
|
||||||
byte[] data = dataStream.toByteArray();
|
byte[] data = dataStream.toByteArray();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user