Files
sdk/runtime/bin/platform_win.cc
T
vegorov@google.com d30ecd3fcd Fix Win64 build of Dart VM.
1. Build script tools/build.py now actually builds X64 target when x64
is passed as an architecture:

- GYP files set 'msvs_configuration_platform': 'x64' for Win_x64
configuration;

- NSS related files are fixed to have correct set of defines for ia32
and x64 builds and include right files. A os_windows.c file added to
work-around inability to have different sets of source files per
configuration. Originally this was controlled through target_arch GYP
define and required regeneration of the solution.

- build.py passes Win32 or x64 platform to devenv as part of build
configuration argument;

2. Dart VM now supports Win64 ABI. ABI description is moved into a
separate class CallingConventions in constants_x64.h.

BUG=http://dartbug.com/7792
R=iposva@google.com, ricow@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//317773002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37078 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-06 12:14:15 +00:00

73 lines
1.5 KiB
C++

// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "platform/globals.h"
#if defined(TARGET_OS_WINDOWS)
#include "bin/platform.h"
#include "bin/log.h"
#include "bin/socket.h"
#include "bin/utils.h"
namespace dart {
namespace bin {
bool Platform::Initialize() {
// Nothing to do on Windows.
return true;
}
int Platform::NumberOfProcessors() {
SYSTEM_INFO info;
GetSystemInfo(&info);
return info.dwNumberOfProcessors;
}
const char* Platform::OperatingSystem() {
return "windows";
}
bool Platform::LocalHostname(char *buffer, intptr_t buffer_length) {
if (!Socket::Initialize()) return false;
return gethostname(buffer, buffer_length) == 0;
}
char** Platform::Environment(intptr_t* count) {
wchar_t* strings = GetEnvironmentStringsW();
if (strings == NULL) return NULL;
wchar_t* tmp = strings;
intptr_t i = 0;
while (*tmp != '\0') {
i++;
tmp += (wcslen(tmp) + 1);
}
*count = i;
char** result = new char*[i];
tmp = strings;
for (intptr_t current = 0; current < i; current++) {
result[current] = StringUtils::WideToUtf8(tmp);
tmp += (wcslen(tmp) + 1);
}
FreeEnvironmentStringsW(strings);
return result;
}
void Platform::FreeEnvironment(char** env, intptr_t count) {
for (intptr_t i = 0; i < count; i++) {
free(env[i]);
}
delete[] env;
}
} // namespace bin
} // namespace dart
#endif // defined(TARGET_OS_WINDOWS)