mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-30 23:20:40 +03:00
use *W-functions if UNICODE #defined on windows
This commit is contained in:
parent
dfbb6c5b08
commit
9f85baee90
2 changed files with 23 additions and 5 deletions
|
@ -28,6 +28,7 @@
|
|||
#include "llvm/Support/SourceMgr.h"
|
||||
#if _WIN32
|
||||
#include "llvm/Support/SystemUtils.h"
|
||||
#include "llvm/Support/ConvertUTF.h"
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
|
@ -426,9 +427,17 @@ int executeAndWait(const char *commandLine) {
|
|||
|
||||
DWORD exitCode;
|
||||
|
||||
#if UNICODE
|
||||
std::wstring wcommandLine;
|
||||
if (!llvm::ConvertUTF8toWide(commandLine, wcommandLine))
|
||||
return -3;
|
||||
auto cmdline = const_cast<wchar_t *>(wcommandLine.data());
|
||||
#else
|
||||
auto cmdline = const_cast<char *>(commandLine);
|
||||
#endif
|
||||
// according to MSDN, only CreateProcessW (unicode) may modify the passed
|
||||
// command line
|
||||
if (!CreateProcess(NULL, const_cast<char *>(commandLine), NULL, NULL, TRUE, 0,
|
||||
if (!CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0,
|
||||
NULL, NULL, &si, &pi)) {
|
||||
exitCode = -1;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue