-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
See PR #280
Fix for MSVC 2022, node 22, on Windows to use more specific declarations+casts.
With node@22 and MS VisualStudio 2022 BuildTools on Windows 10, the registry-js package was failing to build via node-gyp.
I had to upgrade to at least node-gyp@9 (latest node-gyp@11) for it to recognize VisualStudio 2022, and then there were build errors with main.cc that after some investigation appeared to need stricter declaration/casting. I've attempted a reasonable fix based on the errors although I'm not a C/C++ expert. This now npm installs, builds, and npm run test is successful.
main.cc
\registry-js\src\main.cc(128,20): error C2665: '`anonymous-namespace'::CreateEntry': no overloaded function coul
d convert all the argument types [\registry-js\build\registry.vcxproj]
\registry-js\src\main.cc(45,14):
could be 'Napi::Object `anonymous-namespace'::CreateEntry(Napi::Env &,LPWSTR,LPWSTR,LPWSTR,DWORD)'
\registry-js\src\main.cc(128,20):
'Napi::Object `anonymous-namespace'::CreateEntry(Napi::Env &,LPWSTR,LPWSTR,LPWSTR,DWORD)': cannot convert arg
ument 3 from 'const wchar_t [7]' to 'LPWSTR'
\registry-js\src\main.cc(128,47):
Conversion from string literal loses const qualifier (see /Zc:strictStrings)
\registry-js\src\main.cc(128,20):
while trying to match the argument list '(Napi::Env, WCHAR [16383], const wchar_t [7], LPWSTR, DWORD)'
\registry-js\src\main.cc(134,20): error C2665: '`anonymous-namespace'::CreateEntry': no overloaded function coul
d convert all the argument types [\registry-js\build\registry.vcxproj]
\registry-js\src\main.cc(45,14):
could be 'Napi::Object `anonymous-namespace'::CreateEntry(Napi::Env &,LPWSTR,LPWSTR,LPWSTR,DWORD)'
\registry-js\src\main.cc(134,20):
'Napi::Object `anonymous-namespace'::CreateEntry(Napi::Env &,LPWSTR,LPWSTR,LPWSTR,DWORD)': cannot convert arg
ument 3 from 'const wchar_t [14]' to 'LPWSTR'
\registry-js\src\main.cc(134,47):
Conversion from string literal loses const qualifier (see /Zc:strictStrings)
\registry-js\src\main.cc(134,20):
while trying to match the argument list '(Napi::Env, WCHAR [16383], const wchar_t [14], LPWSTR, DWORD)'
pimterry and bradisbell
Metadata
Metadata
Assignees
Labels
No labels