win: work around __pfnDliNotifyHook2 type change

Visual Studio 2015 Update 3 defines __pfnDliNotifyHook2 as const.
The decltype specifier makes the declaration work across all supported
versions of VS. It also requires that the source be compiled as C++.

Fixes: https://github.com/nodejs/node-gyp/issues/949

PR-URL: https://github.com/nodejs/node-gyp/pull/952
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Alexis Campailla 2016-06-13 15:55:30 +02:00 committed by GitHub
parent 3df8222fa5
commit f31482e226
2 changed files with 2 additions and 2 deletions

View file

@ -43,7 +43,7 @@
'conditions': [
[ 'OS=="win"', {
'sources': [
'<(node_gyp_dir)/src/win_delay_load_hook.c',
'<(node_gyp_dir)/src/win_delay_load_hook.cc',
],
'msvs_settings': {
'VCLinkerTool': {

View file

@ -31,6 +31,6 @@ static FARPROC WINAPI load_exe_hook(unsigned int event, DelayLoadInfo* info) {
return (FARPROC) m;
}
PfnDliHook __pfnDliNotifyHook2 = load_exe_hook;
decltype(__pfnDliNotifyHook2) __pfnDliNotifyHook2 = load_exe_hook;
#endif