Repository navigation
Conversation
The win32-x64 prebuild linked its node.exe imports eagerly, so loading lbugjs.node under any host other than node.exe (e.g. Electron's electron.exe) failed with 'A dynamic link library (DLL) initialization routine failed'. Link delayimp and pass /DELAYLOAD:node.exe on MSVC. The win_delay_load_hook.cc from cmake-js (already compiled in via CMAKE_JS_SRC) resolves the imports against the running host process at load time -- the same approach node-gyp uses for every addon. One prebuild now loads in both Node and Electron. Also scope -Wl,--export-dynamic to UNIX so it is not passed to the MSVC linker. Fixes LadybugDB/ladybug#1708.
dumpbin /DEPENDENTS must list node.exe under delay-load dependencies; fail the Windows job otherwise so a regression of LadybugDB/ladybug#1708 is caught at build time.
Contributor
Author
CI runs to watchFull run: https://github.com/LadybugDB/ladybug-nodejs/actions/runs/46184884024
On the Windows job, look for the Verify node.exe delay-load (Windows) step: it prints |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes LadybugDB/ladybug#1708.
Problem
The win32-x64 prebuild links its Node imports against
node.exeeagerly, so loadinglbugjs.nodeunder any host other thannode.exe(e.g. Electron'selectron.exe) fails withA dynamic link library (DLL) initialization routine failed. The addon is N-API, so there is no Node/Electron version mismatch involved — this is purely the Windows loader binding imports by executable name.Fix
delayimpand pass/DELAYLOAD:node.exeon MSVC. Thewin_delay_load_hook.ccfrom cmake-js was already compiled in via${CMAKE_JS_SRC}; it now resolves the imports against the running host process at load time — the same approach node-gyp uses for every addon. One prebuild loads in both Node and Electron.-Wl,--export-dynamicto UNIX so that GNU-ld flag is no longer passed to the MSVC linker.Verification
dumpbin /DEPENDENTSlistsnode.exeunder delay-load dependencies.npm testsuite runs on all four platform jobs as before.