Skip to content

Commit 9eb7763

Browse files
authored
[embind] Remove init_embind. NFC (#22705)
All this function was doing was exporting a bunch of library methods. If folks want to export these functions they can do it themselves using the normal mechanisms.
1 parent ad9210e commit 9eb7763

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ See docs/process.md for more on how version tagging works.
2626
- Fix regression introduced in 3.1.67 (#22557) which broke webgpu / int64
2727
integration. (#22689)
2828
- SDL2 port updated from 2.28.4 to 2.30.8. (#22697)
29+
- embind no longer exports any library functions by default. Previously we
30+
would export getInheritedInstanceCount, getLiveInheritedInstances,
31+
flushPendingDeletes and setDelayFunction. If you need these library function
32+
exprted they can be added to `EXPORTED_RUNTIME_METHODS`. (#22705)
2933

3034
3.1.68 - 09/30/24
3135
-----------------

src/embind/embind.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,6 @@ var LibraryEmbind = {
5959
}`,
6060
$EmValOptionalType__deps: ['$EmValType'],
6161
$EmValOptionalType: '=Object.assign({optional: true}, EmValType);',
62-
$init_embind__deps: [
63-
'$getInheritedInstanceCount', '$getLiveInheritedInstances',
64-
'$flushPendingDeletes', '$setDelayFunction'],
65-
$init_embind__postset: 'init_embind();',
66-
$init_embind: () => {
67-
Module['getInheritedInstanceCount'] = getInheritedInstanceCount;
68-
Module['getLiveInheritedInstances'] = getLiveInheritedInstances;
69-
Module['flushPendingDeletes'] = flushPendingDeletes;
70-
Module['setDelayFunction'] = setDelayFunction;
71-
},
7262

7363
$throwUnboundTypeError__deps: ['$registeredTypes', '$typeDependencies', '$UnboundTypeError', '$getTypeName'],
7464
$throwUnboundTypeError: (message, types) => {
@@ -219,7 +209,6 @@ var LibraryEmbind = {
219209
},
220210

221211
// raw pointer -> instance
222-
$registeredInstances__deps: ['$init_embind'],
223212
$registeredInstances: {},
224213

225214
$getBasestPointer__deps: ['$throwBindingError'],
@@ -1582,6 +1571,8 @@ var LibraryEmbind = {
15821571
'$releaseClassHandle',
15831572
'$throwBindingError',
15841573
'$detachFinalizer',
1574+
'$flushPendingDeletes',
1575+
'$delayFunction',
15851576
],
15861577
$init_ClassHandle: () => {
15871578
Object.assign(ClassHandle.prototype, {

test/test_other.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3240,7 +3240,7 @@ def test_embind(self, *extra_args):
32403240
'-Wno-deprecated-declarations',
32413241
'-lembind',
32423242
'-sRETAIN_COMPILER_SETTINGS',
3243-
'-sEXPORTED_RUNTIME_METHODS=getCompilerSetting',
3243+
'-sEXPORTED_RUNTIME_METHODS=getCompilerSetting,setDelayFunction,flushPendingDeletes',
32443244
'-sWASM_ASYNC_COMPILATION=0',
32453245
# This test uses a `CustomSmartPtr` class which has 1MB of data embedded in
32463246
# it which means we need more stack space than normal.

tools/link.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,6 +1949,7 @@ def run_embind_gen(wasm_target, js_syms, extra_settings, linker_inputs):
19491949
if building.is_wasm_dylib(linker_input):
19501950
safe_copy(linker_input, in_temp(''))
19511951

1952+
settings.EXPORTED_RUNTIME_METHODS = []
19521953
# Ignore any options or settings that can conflict with running the TS
19531954
# generation output.
19541955
# Don't invoke the program's `main` function.

0 commit comments

Comments
 (0)