nwjs / nw-gyp

native addon build tool for node-webkit
MIT License
195 stars 50 forks source link

Unicode problem #93

Open digital-flowers opened 8 years ago

digital-flowers commented 8 years ago

when compile any node addon with USE_WCHAR and UNICODE flags it works will in node-gyp module but it fails in nw-gyp and this a quick workaround to fix this problem

DuBistKomisch commented 8 years ago

I ran into the same problem. A simpler solution is to explicitly use GetModuleHandleA, i.e. the non-wchar/unicode version.

digital-flowers commented 8 years ago

@DuBistKomisch i have no experience that much in cpp but this is how i solved it but now it is the turn of experts like you ;)

robert-j commented 4 years ago

Windows has macros for this situation:

node_dll = GetModuleHandle(TEXT("node.dll"));

You just have to use the TEXT macro to wrap string literals. The macro expands to L"node.dll" for UNICODE and "node.dll" for single byte builds.

GetModuleHandle is already a macro that expands to the A or W version.