mirror of
https://github.com/dart-lang/sdk
synced 2024-07-05 17:30:16 +00:00
Fix builds targeting Android from a Windows host gen_snapshot.
Change-Id: I424fc1b542de7c90799f231499d525cbde699aa1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104950 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
8c9765c648
commit
60f37fa189
|
@ -2,7 +2,7 @@
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
# 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.
|
# BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
if (defined(is_win) && is_win) {
|
if (host_os == "win") {
|
||||||
executable_suffix = ".exe"
|
executable_suffix = ".exe"
|
||||||
} else {
|
} else {
|
||||||
executable_suffix = ""
|
executable_suffix = ""
|
||||||
|
|
|
@ -2,8 +2,14 @@
|
||||||
// for details. All rights reserved. Use of this source code is governed by a
|
// 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.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
#if !defined(TARGET_OS_LINUX) && !defined(TARGET_OS_MACOS) && \
|
#include "include/dart_api.h"
|
||||||
!defined(TARGET_OS_ANDROID)
|
#include "vm/bootstrap_natives.h"
|
||||||
|
#include "vm/exceptions.h"
|
||||||
|
#include "vm/globals.h"
|
||||||
|
#include "vm/native_entry.h"
|
||||||
|
|
||||||
|
#if !defined(HOST_OS_LINUX) && !defined(HOST_OS_MACOS) && \
|
||||||
|
!defined(HOST_OS_ANDROID)
|
||||||
// TODO(dacoharkes): Implement dynamic libraries for other targets & merge the
|
// TODO(dacoharkes): Implement dynamic libraries for other targets & merge the
|
||||||
// implementation with:
|
// implementation with:
|
||||||
// - runtime/bin/extensions.h
|
// - runtime/bin/extensions.h
|
||||||
|
@ -13,16 +19,11 @@
|
||||||
#else
|
#else
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
#include "include/dart_api.h"
|
|
||||||
#include "vm/bootstrap_natives.h"
|
|
||||||
#include "vm/exceptions.h"
|
|
||||||
#include "vm/native_entry.h"
|
|
||||||
|
|
||||||
namespace dart {
|
namespace dart {
|
||||||
|
|
||||||
static void* LoadExtensionLibrary(const char* library_file) {
|
static void* LoadExtensionLibrary(const char* library_file) {
|
||||||
#if defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS) || \
|
#if defined(HOST_OS_LINUX) || defined(HOST_OS_MACOS) || defined(HOST_OS_ANDROID)
|
||||||
defined(TARGET_OS_ANDROID)
|
|
||||||
void* handle = dlopen(library_file, RTLD_LAZY);
|
void* handle = dlopen(library_file, RTLD_LAZY);
|
||||||
if (handle == nullptr) {
|
if (handle == nullptr) {
|
||||||
char* error = dlerror();
|
char* error = dlerror();
|
||||||
|
@ -32,7 +33,7 @@ static void* LoadExtensionLibrary(const char* library_file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
#elif defined(TARGET_OS_WINDOWS)
|
#elif defined(HOST_OS_WINDOWS)
|
||||||
SetLastError(0); // Clear any errors.
|
SetLastError(0); // Clear any errors.
|
||||||
|
|
||||||
// Convert to wchar_t string.
|
// Convert to wchar_t string.
|
||||||
|
@ -70,8 +71,7 @@ DEFINE_NATIVE_ENTRY(Ffi_dl_open, 0, 1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* ResolveSymbol(void* handle, const char* symbol) {
|
static void* ResolveSymbol(void* handle, const char* symbol) {
|
||||||
#if defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS) || \
|
#if defined(HOST_OS_LINUX) || defined(HOST_OS_MACOS) || defined(HOST_OS_ANDROID)
|
||||||
defined(TARGET_OS_ANDROID)
|
|
||||||
dlerror(); // Clear any errors.
|
dlerror(); // Clear any errors.
|
||||||
void* pointer = dlsym(handle, symbol);
|
void* pointer = dlsym(handle, symbol);
|
||||||
if (pointer == nullptr) {
|
if (pointer == nullptr) {
|
||||||
|
@ -81,7 +81,7 @@ static void* ResolveSymbol(void* handle, const char* symbol) {
|
||||||
Exceptions::ThrowArgumentError(msg);
|
Exceptions::ThrowArgumentError(msg);
|
||||||
}
|
}
|
||||||
return pointer;
|
return pointer;
|
||||||
#elif defined(TARGET_OS_WINDOWS)
|
#elif defined(HOST_OS_WINDOWS)
|
||||||
SetLastError(0);
|
SetLastError(0);
|
||||||
void* pointer = GetProcAddress(reinterpret_cast<HMODULE>(handle), symbol);
|
void* pointer = GetProcAddress(reinterpret_cast<HMODULE>(handle), symbol);
|
||||||
if (pointer == nullptr) {
|
if (pointer == nullptr) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user