Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/libasync.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ addToLibrary({
_load_secondary_module: async function() {
// Mark the module as loading for the wasm module (so it doesn't try to load it again).
wasmExports['load_secondary_module_status'].value = 1;
var imports = {'primary': wasmExports};
var imports = {'primary': wasmRawExports};
// Replace '.wasm' suffix with '.deferred.wasm'.
var deferred = wasmBinaryFile.slice(0, -5) + '.deferred.wasm';
await instantiateAsync(null, deferred, imports);
Expand Down
3 changes: 3 additions & 0 deletions src/postamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ function checkUnflushedContent() {
#endif // ASSERTIONS

var wasmExports;
#if SPLIT_MODULE
var wasmRawExports;
#endif

#if MODULARIZE == 'instance'
// In MODULARIZE=instance mode we delay most of the initialization work until
Expand Down
5 changes: 4 additions & 1 deletion src/preamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ var splitModuleProxyHandler = {
#if RUNTIME_DEBUG
dbg(`placeholder function called: ${base}`);
#endif
var imports = {'primary': wasmExports};
var imports = {'primary': wasmRawExports};
// Replace '.wasm' suffix with '.deferred.wasm'.
loadSplitModule(secondaryFile, imports, base);
#if RUNTIME_DEBUG
Expand Down Expand Up @@ -734,6 +734,9 @@ function getWasmImports() {
reportUndefinedSymbols();
#endif

#if SPLIT_MODULE
wasmRawExports = wasmExports;
#endif
#if MEMORY64 || CAN_ADDRESS_2GB
wasmExports = applySignatureConversions(wasmExports);
#endif
Expand Down
8 changes: 8 additions & 0 deletions test/other/test_split_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@ int foo() {

EMSCRIPTEN_KEEPALIVE void say_hello() {
printf("Hello! answer: %d\n", foo());

void* ptr = malloc(10);
if (ptr == NULL) {
return;
}

free(ptr);
ptr = NULL;
}