| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #if defined(FLETCH_TARGET_OS_WIN) | 5 #if defined(DARTINO_TARGET_OS_WIN) |
| 6 | 6 |
| 7 #ifdef FLETCH_ENABLE_FFI | 7 #ifdef DARTINO_ENABLE_FFI |
| 8 | 8 |
| 9 #include "src/vm/ffi.h" | 9 #include "src/vm/ffi.h" |
| 10 | 10 |
| 11 #include <Windows.h> | 11 #include <Windows.h> |
| 12 | 12 |
| 13 #include "src/shared/platform.h" | 13 #include "src/shared/platform.h" |
| 14 #include "src/vm/natives.h" | 14 #include "src/vm/natives.h" |
| 15 #include "src/vm/object.h" | 15 #include "src/vm/object.h" |
| 16 #include "src/vm/process.h" | 16 #include "src/vm/process.h" |
| 17 | 17 |
| 18 namespace fletch { | 18 namespace dartino { |
| 19 | 19 |
| 20 const char* ForeignUtils::kLibBundlePrefix = "\\lib\\"; | 20 const char* ForeignUtils::kLibBundlePrefix = "\\lib\\"; |
| 21 const char* ForeignUtils::kLibBundlePostfix = ".dll"; | 21 const char* ForeignUtils::kLibBundlePostfix = ".dll"; |
| 22 | 22 |
| 23 char* ForeignUtils::DirectoryName(char* path, char *buffer, size_t len) { | 23 char* ForeignUtils::DirectoryName(char* path, char *buffer, size_t len) { |
| 24 TCHAR *file_name_ptr; | 24 TCHAR *file_name_ptr; |
| 25 if (GetFullPathName(path, len, buffer, &file_name_ptr) == 0) { | 25 if (GetFullPathName(path, len, buffer, &file_name_ptr) == 0) { |
| 26 buffer[0] = '\0'; | 26 buffer[0] = '\0'; |
| 27 return buffer; | 27 return buffer; |
| 28 } | 28 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 delete mutex_; | 74 delete mutex_; |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool ForeignFunctionInterface::AddDefaultSharedLibrary(const char* library) { | 77 bool ForeignFunctionInterface::AddDefaultSharedLibrary(const char* library) { |
| 78 ScopedLock lock(mutex_); | 78 ScopedLock lock(mutex_); |
| 79 | 79 |
| 80 HMODULE handle = LoadLibrary(library); | 80 HMODULE handle = LoadLibrary(library); |
| 81 | 81 |
| 82 if (handle != NULL) { | 82 if (handle != NULL) { |
| 83 // We have to maintain the insertion order (see fletch_api.h). | 83 // We have to maintain the insertion order (see dartino_api.h). |
| 84 if (libraries_ == NULL) { | 84 if (libraries_ == NULL) { |
| 85 libraries_ = new DefaultLibraryEntry(handle, libraries_); | 85 libraries_ = new DefaultLibraryEntry(handle, libraries_); |
| 86 } else { | 86 } else { |
| 87 libraries_->append(new DefaultLibraryEntry(handle, libraries_)); | 87 libraries_->append(new DefaultLibraryEntry(handle, libraries_)); |
| 88 } | 88 } |
| 89 return true; | 89 return true; |
| 90 } | 90 } |
| 91 | 91 |
| 92 return false; | 92 return false; |
| 93 } | 93 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 if (wrote > MAXPATHLEN) { | 157 if (wrote > MAXPATHLEN) { |
| 158 return Failure::index_out_of_bounds(); | 158 return Failure::index_out_of_bounds(); |
| 159 } | 159 } |
| 160 return process->NewStringFromAscii(List<const char>(result, strlen(result))); | 160 return process->NewStringFromAscii(List<const char>(result, strlen(result))); |
| 161 } | 161 } |
| 162 END_NATIVE() | 162 END_NATIVE() |
| 163 | 163 |
| 164 BEGIN_NATIVE(ForeignErrno) { return Smi::FromWord(GetLastError()); } | 164 BEGIN_NATIVE(ForeignErrno) { return Smi::FromWord(GetLastError()); } |
| 165 END_NATIVE() | 165 END_NATIVE() |
| 166 | 166 |
| 167 } // namespace fletch | 167 } // namespace dartino |
| 168 | 168 |
| 169 #endif // FLETCH_ENABLE_FFI | 169 #endif // DARTINO_ENABLE_FFI |
| 170 | 170 |
| 171 #endif // defined(FLETCH_TARGET_OS_WIN) | 171 #endif // defined(DARTINO_TARGET_OS_WIN) |
| OLD | NEW |