You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to node-gyp@11.1.0, I encountered a build failure on Windows due to an incorrect function call in win_delay_load_hook.cc. The issue is caused by GetModuleHandle, which expects a wide string (LPCWSTR) but is receiving a narrow string (char*).
This happens on both local hardware and GitHub runners.
Error Message
C:\Users\myuser\AppData\Local\Yarn\Data\global\node_modules\node-gyp\src\win_delay_load_hook.cc(32,36): error C2664: 'HMODULE GetModuleHandleW(LPCWSTR)': cannot convert argument 1 from 'const char [12]' to 'LPCWSTR'
Additional Context
This issue appears to be introduced by changes in #2834, which were merged and released as part of node-gyp@11.1.0
I'm not a C++ expert, but I attempted a modification in win_delay_load_hook.cc to explicitly use GetModuleHandleA (ANSI) instead of GetModuleHandle, which defaults to GetModuleHandleW (wide-character version).
Change this:
m = GetModuleHandle("libnode.dll");
to this:
m = GetModuleHandleA("libnode.dll");
If this sounds like a reasonable solution, I can open a PR.
Would appreciate any comments from the maintainers.
Description
After upgrading to
node-gyp@11.1.0
, I encountered a build failure on Windows due to an incorrect function call inwin_delay_load_hook.cc
. The issue is caused byGetModuleHandle
, which expects a wide string (LPCWSTR
) but is receiving a narrow string (char*
).This happens on both local hardware and GitHub runners.
Error Message
Additional Context
This issue appears to be introduced by changes in #2834, which were merged and released as part of
node-gyp@11.1.0
Detailed logs (GitHub Actions run): logs from the failed build
Affected Versions
11.1.0
18.x
,20.x
,22.x
Proposed Fix
I'm not a C++ expert, but I attempted a modification in
win_delay_load_hook.cc
to explicitly useGetModuleHandleA
(ANSI) instead ofGetModuleHandle
, which defaults toGetModuleHandleW
(wide-character version).Change this:
m = GetModuleHandle("libnode.dll");
to this:
m = GetModuleHandleA("libnode.dll");
If this sounds like a reasonable solution, I can open a PR.
Would appreciate any comments from the maintainers.
@zombieyang
The text was updated successfully, but these errors were encountered: