@@ -1174,8 +1174,8 @@ var LibraryDylink = {
11741174 } ,
11751175
11761176 $loadDylibs__internal : true ,
1177- $loadDylibs__deps : [ '$loadDynamicLibrary' , '$reportUndefinedSymbols' ] ,
1178- $loadDylibs : ( ) => {
1177+ $loadDylibs__deps : [ '$loadDynamicLibrary' , '$reportUndefinedSymbols' , '$addRunDependency' , '$removeRunDependency' ] ,
1178+ $loadDylibs : async ( ) => {
11791179 if ( ! dynamicLibraries . length ) {
11801180#if DYLINK_DEBUG
11811181 dbg ( 'loadDylibs: no libraries to preload' ) ;
@@ -1187,21 +1187,19 @@ var LibraryDylink = {
11871187#if DYLINK_DEBUG
11881188 dbg ( 'loadDylibs:' , dynamicLibraries ) ;
11891189#endif
1190+ addRunDependency ( 'loadDylibs' ) ;
11901191
11911192 // Load binaries asynchronously
1192- addRunDependency ( 'loadDylibs' ) ;
1193- dynamicLibraries
1194- . reduce ( ( chain , lib ) => chain . then ( ( ) =>
1195- loadDynamicLibrary ( lib , { loadAsync : true , global : true , nodelete : true , allowUndefined : true } )
1196- ) , Promise . resolve ( ) )
1197- . then ( ( ) => {
1198- // we got them all, wonderful
1199- reportUndefinedSymbols ( ) ;
1200- removeRunDependency ( 'loadDylibs' ) ;
1201- #if DYLINK_DEBUG
1202- dbg ( 'loadDylibs done!' ) ;
1203- #endif
1204- } ) ;
1193+ for ( var lib of dynamicLibraries ) {
1194+ await loadDynamicLibrary ( lib , { loadAsync : true , global : true , nodelete : true , allowUndefined : true } )
1195+ }
1196+ // we got them all, wonderful
1197+ reportUndefinedSymbols ( ) ;
1198+
1199+ #if DYLINK_DEBUG
1200+ dbg ( 'loadDylibs done!' ) ;
1201+ #endif
1202+ removeRunDependency ( 'loadDylibs' ) ;
12051203 } ,
12061204
12071205 // void* dlopen(const char* filename, int flags);
0 commit comments