From f31482e2260e3beb90d959c62135e5e95c06ed4d Mon Sep 17 00:00:00 2001 From: Alexis Campailla Date: Mon, 13 Jun 2016 15:55:30 +0200 Subject: [PATCH] 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 --- addon.gypi | 2 +- src/{win_delay_load_hook.c => win_delay_load_hook.cc} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/{win_delay_load_hook.c => win_delay_load_hook.cc} (92%) diff --git a/addon.gypi b/addon.gypi index 62e8bc67c7..118ff22769 100644 --- a/addon.gypi +++ b/addon.gypi @@ -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': { diff --git a/src/win_delay_load_hook.c b/src/win_delay_load_hook.cc similarity index 92% rename from src/win_delay_load_hook.c rename to src/win_delay_load_hook.cc index b1e170aa13..e75954b605 100644 --- a/src/win_delay_load_hook.c +++ b/src/win_delay_load_hook.cc @@ -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