| From 3b353a4dbc0e96a35d18dde94a787945f1c5c58a Mon Sep 17 00:00:00 2001 |
| From: Alethea Rose <alethea@alethearose.com> |
| Date: Wed, 15 Feb 2017 19:11:53 -0500 |
| Subject: [PATCH 08/23] Link with -municode and extern wmain for Unicode |
| |
| --- |
| node.gyp | 5 +++-- |
| node.gypi | 1 + |
| src/node_main.cc | 9 +++++++++ |
| 3 files changed, 13 insertions(+), 2 deletions(-) |
| |
| diff --git a/node.gyp b/node.gyp |
| index dba17e28..aa6e0588 100644 |
| --- a/node.gyp |
| +++ b/node.gyp |
| @@ -586,7 +586,7 @@ |
| ], |
| }], |
| ], |
| - 'libraries': [ '-lpsapi' ] |
| + 'libraries': [ '-municode', '-lpsapi' ] |
| }], |
| [ 'node_use_etw=="true"', { |
| 'defines': [ 'HAVE_ETW=1' ], |
| @@ -993,7 +993,8 @@ |
| '<(SHARED_INTERMEDIATE_DIR)', # for node_natives.h |
| ], |
| |
| - 'defines': [ 'NODE_WANT_INTERNALS=1' ], |
| + 'defines': [ 'NODE_WANT_INTERNALS=1', '_UNICODE=1', 'UNICODE' ], |
| + 'libraries': [ '-municode' ], |
| |
| 'sources': [ |
| 'test/cctest/node_module_reg.cc', |
| diff --git a/node.gypi b/node.gypi |
| index dba17e28..aa6e0588 100644 |
| --- a/node.gypi |
| +++ b/node.gypi |
| @@ -64,6 +64,7 @@ |
| # but we still inherit it from uv.h. |
| 'NOMINMAX', |
| '_UNICODE=1', |
| + 'UNICODE', |
| ], |
| }, { # POSIX |
| 'defines': [ '__POSIX__' ], |
| diff --git a/src/node_main.cc b/src/node_main.cc |
| index 2a511b92..d592a1f8 100644 |
| --- a/src/node_main.cc |
| +++ b/src/node_main.cc |
| @@ -27,6 +27,10 @@ |
| #include <VersionHelpers.h> |
| #include <WinError.h> |
| |
| +#if defined(__MINGW_VERSION_MAJOR) |
| +#extern "C" { |
| +#endif |
| + |
| int wmain(int argc, wchar_t* wargv[]) { |
| if (!IsWindows7OrGreater()) { |
| fprintf(stderr, "This application is only supported on Windows 7, " |
| @@ -71,6 +75,11 @@ int wmain(int argc, wchar_t *wargv[]) { |
| // Now that conversion is done, we can finally start. |
| return node::Start(argc, argv); |
| } |
| + |
| +#if defined(__MINGW_VERSION_MAJOR) |
| +} |
| +#endif |
| + |
| #else |
| // UNIX |
| #ifdef __linux__ |
| -- |
| 2.17.0.windows.1 |