| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4dc8a38 commit e1bd53c
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -458,6 +458,10 @@ | |||
| 458 | 458 | '_HAS_EXCEPTIONS=0', | |
| 459 | 459 | 'BUILDING_V8_SHARED=1', | |
| 460 | 460 | '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', | ||
| 461 | 465 | ], | |
| 462 | 466 | }], | |
| 463 | 467 | [ 'OS in "linux freebsd openbsd solaris aix os400"', { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,10 +63,6 @@ | |||
| 63 | 63 | 'FD_SETSIZE=1024', | |
| 64 | 64 | # we need to use node's preferred "win32" rather than gyp's preferred "win" | |
| 65 | 65 | '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', | ||
| 70 | 66 | '_UNICODE=1', | |
| 71 | 67 | ], | |
| 72 | 68 | 'msvs_precompiled_header': 'tools/msvs/pch/node_pch.h', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,11 @@ | |||
| 4 | 4 | 'target_name': 'binding', | |
| 5 | 5 | 'sources': [ 'binding.cc' ], | |
| 6 | 6 | 'includes': ['../common.gypi'], | |
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + 'target_name': 'binding2', | ||
| 10 | + 'sources': [ 'binding2.cc' ], | ||
| 11 | + 'includes': ['../common.gypi'], | ||
| 7 | 12 | } | |
| 8 | 13 | ] | |
| 9 | 14 | } | |
| Original file line number | Diff line number | Diff 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) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,9 @@ const binding = require(bindingPath); | |||
| 6 | 6 | assert.strictEqual(binding.hello(), 'world'); | |
| 7 | 7 | console.log('binding.hello() =', binding.hello()); | |
| 8 | 8 | ||
| 9 | + const binding2 = require(require.resolve(`./build/${common.buildType}/binding2`)); | ||
| 10 | + assert.strictEqual(binding2.hello(), 'world'); | ||
| 11 | + | ||
| 9 | 12 | // Test multiple loading of the same module. | |
| 10 | 13 | delete require.cache[bindingPath]; | |
| 11 | 14 | const rebinding = require(bindingPath); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments