GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — build: define `NOMINMAX` in common.gypi · nodejs/node@e1bd53c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • common.gypi
  • node.gypi
  • test/addons/hello-world
    • binding.gyp
    • binding2.cc
    • test.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,10 @@
458458
'_HAS_EXCEPTIONS=0',
459459
'BUILDING_V8_SHARED=1',
460460
'BUILDING_UV_SHARED=1',
461+
# Stop <windows.h> from defining macros that conflict with
462+
# std::min() and std::max(). We don't use <windows.h> (much)
463+
# but we still inherit it from uv.h.
464+
'NOMINMAX',
461465
],
462466
}],
463467
[ 'OS in "linux freebsd openbsd solaris aix os400"', {
Collapse file

‎node.gypi‎

Copy file name to clipboardExpand all lines: node.gypi
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@
6363
'FD_SETSIZE=1024',
6464
# we need to use node's preferred "win32" rather than gyp's preferred "win"
6565
'NODE_PLATFORM="win32"',
66-
# Stop <windows.h> from defining macros that conflict with
67-
# std::min() and std::max(). We don't use <windows.h> (much)
68-
# but we still inherit it from uv.h.
69-
'NOMINMAX',
7066
'_UNICODE=1',
7167
],
7268
'msvs_precompiled_header': 'tools/msvs/pch/node_pch.h',
Collapse file

‎test/addons/hello-world/binding.gyp‎

Copy file name to clipboardExpand all lines: test/addons/hello-world/binding.gyp
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
'target_name': 'binding',
55
'sources': [ 'binding.cc' ],
66
'includes': ['../common.gypi'],
7+
},
8+
{
9+
'target_name': 'binding2',
10+
'sources': [ 'binding2.cc' ],
11+
'includes': ['../common.gypi'],
712
}
813
]
914
}
Collapse file

‎test/addons/hello-world/binding2.cc‎

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Include uv.h and v8.h ahead of node.h to verify that node.h doesn't need to
2+
// be included first. Disable clang-format as it will sort the include lists.
3+
// clang-format off
4+
#include <uv.h>
5+
#include <v8.h>
6+
#include <node.h>
7+
// clang-format on
8+
9+
static void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
10+
v8::Isolate* isolate = args.GetIsolate();
11+
args.GetReturnValue().Set(
12+
v8::String::NewFromUtf8(isolate, "world").ToLocalChecked());
13+
}
14+
15+
static void InitModule(v8::Local<v8::Object> exports,
16+
v8::Local<v8::Value> module,
17+
v8::Local<v8::Context> context) {
18+
NODE_SET_METHOD(exports, "hello", Method);
19+
}
20+
21+
NODE_MODULE(NODE_GYP_MODULE_NAME, InitModule)
Collapse file

‎test/addons/hello-world/test.js‎

Copy file name to clipboardExpand all lines: test/addons/hello-world/test.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ const binding = require(bindingPath);
66
assert.strictEqual(binding.hello(), 'world');
77
console.log('binding.hello() =', binding.hello());
88

9+
const binding2 = require(require.resolve(`./build/${common.buildType}/binding2`));
10+
assert.strictEqual(binding2.hello(), 'world');
11+
912
// Test multiple loading of the same module.
1013
delete require.cache[bindingPath];
1114
const rebinding = require(bindingPath);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.