Skip to content

Commit 58949ca

Browse files
committed
win: make delay-load hook optional
1 parent 1670d26 commit 58949ca

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

addon.gypi

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
'target_defaults': {
33
'type': 'loadable_module',
4+
'win_delay_load_hook': 'false',
45
'product_prefix': '',
6+
57
'include_dirs': [
68
'<(node_root_dir)/src',
79
'<(node_root_dir)/deps/uv/include',
@@ -13,11 +15,34 @@
1315
'product_extension': 'node',
1416
'defines': [ 'BUILDING_NODE_EXTENSION' ],
1517
}],
18+
1619
['_type=="static_library"', {
1720
# set to `1` to *disable* the -T thin archive 'ld' flag.
1821
# older linkers don't support this flag.
1922
'standalone_static_library': '<(standalone_static_library)'
2023
}],
24+
25+
['_win_delay_load_hook=="true"', {
26+
# If the has the 'win_delay_load_hook' option set to 'true', link a
27+
# delay-load hook into the DLL. That hook ensures that the addon
28+
# will work regardless of whether the node/iojs binary is named
29+
# node.exe, iojs.exe, or something else.
30+
'conditions': [
31+
[ 'OS=="win"', {
32+
'sources': [
33+
'src/win_delay_load_hook.c',
34+
],
35+
'msvs_settings': {
36+
'VCLinkerTool': {
37+
'DelayLoadDLLs': [ 'iojs.exe', 'node.exe' ],
38+
# Don't print a linker warning when no imports from either .exe
39+
# are used.
40+
'AdditionalOptions': [ '/ignore:4199' ],
41+
},
42+
},
43+
}],
44+
],
45+
}],
2146
],
2247

2348
'conditions': [
@@ -29,9 +54,6 @@
2954
},
3055
}],
3156
[ 'OS=="win"', {
32-
'sources': [
33-
'src/win_delay_load_hook.c',
34-
],
3557
'libraries': [
3658
'-lkernel32.lib',
3759
'-luser32.lib',
@@ -50,15 +72,6 @@
5072
# warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent<T>'
5173
# needs to have dll-interface to be used by clients of class 'node::ObjectWrap'
5274
'msvs_disabled_warnings': [ 4251 ],
53-
# Set up delay-loading for node.exe/iojs.exe so the loadable module
54-
# will still be able to find its imports if the binary is renamed.
55-
'msvs_settings': {
56-
'VCLinkerTool': {
57-
'DelayLoadDLLs': [ 'iojs.exe', 'node.exe' ],
58-
# Don't print a linker warning when no imports from either .exe are used.
59-
'AdditionalOptions': [ '/ignore:4199' ],
60-
}
61-
},
6275
}, {
6376
# OS!="win"
6477
'defines': [ '_LARGEFILE_SOURCE', '_FILE_OFFSET_BITS=64' ],

0 commit comments

Comments
 (0)