| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "bin/extensions.h" | 8 #include "bin/extensions.h" |
| 9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
| 10 #include "bin/utils_win.h" | 10 #include "bin/utils_win.h" |
| 11 | 11 |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 namespace bin { | 14 namespace bin { |
| 15 | 15 |
| 16 const char* kPrecompiledLibraryName = "precompiled.dll"; | 16 const char* kPrecompiledLibraryName = "precompiled.dll"; |
| 17 const char* kPrecompiledSymbolName = "_kInstructionsSnapshot"; | 17 const char* kPrecompiledSymbolName = "_kInstructionsSnapshot"; |
| 18 | 18 |
| 19 void* Extensions::LoadExtensionLibrary(const char* library_file) { | 19 Dart_Handle Extensions::LoadExtensionLibrary(const char* library_file, |
| 20 return LoadLibraryW(StringUtilsWin::Utf8ToWide(library_file)); | 20 void** library_handle) { |
| 21 ASSERT(library_handle != NULL); |
| 22 *library_handle = LoadLibraryW(StringUtilsWin::Utf8ToWide(library_file)); |
| 23 if (*library_handle == NULL) { |
| 24 OSError err; |
| 25 return Dart_NewApiError(err.message()); |
| 26 } |
| 27 return Dart_Null(); |
| 21 } | 28 } |
| 22 | 29 |
| 23 void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) { | 30 Dart_Handle Extensions::ResolveSymbol(void* lib_handle, |
| 24 return GetProcAddress(reinterpret_cast<HMODULE>(lib_handle), symbol); | 31 const char* symbol, |
| 32 void** init_function) { |
| 33 ASSERT(init_function != NULL); |
| 34 *init_function = GetProcAddress( |
| 35 reinterpret_cast<HMODULE>(lib_handle), symbol); |
| 36 if (*init_function == NULL) { |
| 37 OSError err; |
| 38 return Dart_NewApiError(err.message()); |
| 39 } |
| 40 return Dart_Null(); |
| 25 } | 41 } |
| 26 | 42 |
| 27 } // namespace bin | 43 } // namespace bin |
| 28 } // namespace dart | 44 } // namespace dart |
| 29 | 45 |
| 30 #endif // defined(TARGET_OS_WINDOWS) | 46 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |