Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/src/lib/libexports.js
4150 views
1
/**
2
* @license
3
* Copyright 2020 The Emscripten Authors
4
* SPDX-License-Identifier: MIT
5
*/
6
7
addToLibrary({
8
emscripten_get_exported_function__deps: ['$addFunction', '$UTF8ToString'],
9
emscripten_get_exported_function: (name) => {
10
name = UTF8ToString(name);
11
// Wasm backend does not use C name mangling on exports,
12
// so adjust for that manually.
13
if (name[0] == '_') name = name.slice(1);
14
var exportedFunc = wasmExports[name];
15
if (exportedFunc) {
16
// Note: addFunction automatically caches the created function pointer.
17
return addFunction(exportedFunc);
18
}
19
#if ASSERTIONS
20
err(`No exported function found by name "{exportedFunc}"`);
21
#endif
22
// implicit return 0;
23
}
24
});
25
26