Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/src/postlibrary.js
4128 views
1
// This file is included after the automatically-generated JS library code
2
// but before the wasm module is created.
3
4
#if MODULARIZE == 'instance'
5
function processModuleArgs()
6
#endif
7
{
8
#if IMPORTED_MEMORY && !WASM_ESM_INTEGRATION
9
// With WASM_ESM_INTEGRATION this has to happen at the top level and not
10
// delayed until processModuleArgs.
11
initMemory();
12
#endif
13
14
<<< ATMODULES >>>
15
16
#if ASSERTIONS
17
checkIncomingModuleAPI();
18
#endif
19
20
{{{ makeModuleReceive('arguments_', 'arguments') }}}
21
{{{ makeModuleReceive('thisProgram') }}}
22
23
#if ASSERTIONS
24
// Assertions on removed incoming Module JS APIs.
25
assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');
26
assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');
27
assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');
28
assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead');
29
assert(typeof Module['read'] == 'undefined', 'Module.read option was removed');
30
assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)');
31
assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)');
32
assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)');
33
assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY');
34
assert(typeof Module['ENVIRONMENT'] == 'undefined', 'Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');
35
assert(typeof Module['STACK_SIZE'] == 'undefined', 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time')
36
#if !IMPORTED_MEMORY
37
// If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY
38
assert(typeof Module['wasmMemory'] == 'undefined', 'Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally');
39
assert(typeof Module['INITIAL_MEMORY'] == 'undefined', 'Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically');
40
#endif
41
#endif // ASSERTIONS
42
43
#if expectToReceiveOnModule('preInit')
44
if (Module['preInit']) {
45
if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']];
46
while (Module['preInit'].length > 0) {
47
Module['preInit'].shift()();
48
}
49
}
50
#if ASSERTIONS
51
consumedModuleProp('preInit');
52
#endif
53
#endif
54
}
55
56
{{{ exportJSSymbols() }}}
57
58