MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / create_module

Function create_module

tools/emscripten.py:1085–1115  ·  view source on GitHub ↗
(metadata, function_exports, other_exports, library_symbols, aliases)

Source from the content-addressed store, hash-verified

1083
1084
1085def create_module(metadata, function_exports, other_exports, library_symbols, aliases):
1086 module = []
1087 module.append(create_receiving(function_exports, other_exports, library_symbols, aliases))
1088
1089 sending = create_sending(metadata, library_symbols)
1090 if settings.WASM_ESM_INTEGRATION:
1091 module.append(sending)
1092 else:
1093 if settings.PTHREADS or settings.WASM_WORKERS or (settings.IMPORTED_MEMORY and settings.MODULARIZE == 'instance'):
1094 sending = textwrap.indent(sending, ' ').strip()
1095 module.append('''\
1096 var wasmImports;
1097 function assignWasmImports() {
1098 wasmImports = %s;
1099 }''' % sending)
1100 else:
1101 module.append('var wasmImports = %s;' % sending)
1102
1103 if settings.SUPPORT_LONGJMP == 'emscripten' or not settings.DISABLE_EXCEPTION_CATCHING:
1104 module += create_invoke_wrappers(metadata)
1105 else:
1106 assert not metadata.invoke_funcs, "invoke_ functions exported but exceptions and longjmp are both disabled"
1107
1108 if settings.MEMORY64 or settings.CAN_ADDRESS_2GB:
1109 module.append(create_pointer_conversion_wrappers(metadata))
1110
1111 if settings.WASM_ESM_INTEGRATION:
1112 module.append(create_reexports(metadata))
1113
1114 module = [chunk for chunk in module if chunk]
1115 return '\n\n'.join(module) + '\n'
1116
1117
1118def create_invoke_wrappers(metadata):

Callers 1

emscriptFunction · 0.85

Calls 7

create_receivingFunction · 0.85
create_sendingFunction · 0.85
create_invoke_wrappersFunction · 0.85
create_reexportsFunction · 0.85
appendMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected