Skip to content

Commit

Permalink
win: make delay-load hook optional
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Mar 26, 2015
1 parent 1670d26 commit 58949ca
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions addon.gypi
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
'target_defaults': {
'type': 'loadable_module',
'win_delay_load_hook': 'false',
'product_prefix': '',

'include_dirs': [
'<(node_root_dir)/src',
'<(node_root_dir)/deps/uv/include',
Expand All @@ -13,11 +15,34 @@
'product_extension': 'node',
'defines': [ 'BUILDING_NODE_EXTENSION' ],
}],

['_type=="static_library"', {
# set to `1` to *disable* the -T thin archive 'ld' flag.
# older linkers don't support this flag.
'standalone_static_library': '<(standalone_static_library)'
}],

['_win_delay_load_hook=="true"', {
# If the has the 'win_delay_load_hook' option set to 'true', link a
# delay-load hook into the DLL. That hook ensures that the addon
# will work regardless of whether the node/iojs binary is named
# node.exe, iojs.exe, or something else.
'conditions': [
[ 'OS=="win"', {
'sources': [
'src/win_delay_load_hook.c',
],
'msvs_settings': {
'VCLinkerTool': {
'DelayLoadDLLs': [ 'iojs.exe', 'node.exe' ],
# Don't print a linker warning when no imports from either .exe
# are used.
'AdditionalOptions': [ '/ignore:4199' ],
},
},
}],
],
}],
],

'conditions': [
Expand All @@ -29,9 +54,6 @@
},
}],
[ 'OS=="win"', {
'sources': [
'src/win_delay_load_hook.c',
],
'libraries': [
'-lkernel32.lib',
'-luser32.lib',
Expand All @@ -50,15 +72,6 @@
# warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent<T>'
# needs to have dll-interface to be used by clients of class 'node::ObjectWrap'
'msvs_disabled_warnings': [ 4251 ],
# Set up delay-loading for node.exe/iojs.exe so the loadable module
# will still be able to find its imports if the binary is renamed.
'msvs_settings': {
'VCLinkerTool': {
'DelayLoadDLLs': [ 'iojs.exe', 'node.exe' ],
# Don't print a linker warning when no imports from either .exe are used.
'AdditionalOptions': [ '/ignore:4199' ],
}
},
}, {
# OS!="win"
'defines': [ '_LARGEFILE_SOURCE', '_FILE_OFFSET_BITS=64' ],
Expand Down

0 comments on commit 58949ca

Please sign in to comment.