Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Unified Diff: runtime/bin/extensions_win.cc

Issue 1403683007: Fix for issue 23908 - error message reports the exact error when a native extension fails to load. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/bin/extensions_win.cc
diff --git a/runtime/bin/extensions_win.cc b/runtime/bin/extensions_win.cc
index 8c0a15fb5c32619a467cd5755bc6240fb80b97cf..ec68c5ba90f13a755f51618d172df47a6dd6030f 100644
--- a/runtime/bin/extensions_win.cc
+++ b/runtime/bin/extensions_win.cc
@@ -2,6 +2,7 @@
// 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/assert.h"
#include "platform/globals.h"
#if defined(TARGET_OS_WINDOWS)
@@ -16,12 +17,28 @@ namespace bin {
const char* kPrecompiledLibraryName = "precompiled.dll";
const char* kPrecompiledSymbolName = "_kInstructionsSnapshot";
-void* Extensions::LoadExtensionLibrary(const char* library_file) {
- return LoadLibraryW(StringUtilsWin::Utf8ToWide(library_file));
+Dart_Handle Extensions::LoadExtensionLibrary(const char* library_file,
+ void** library_handle) {
+ ASSERT(library_handle != NULL);
+ *library_handle = LoadLibraryW(StringUtilsWin::Utf8ToWide(library_file));
+ if (*library_handle == NULL) {
+ OSError err;
+ return Dart_NewApiError(err.message());
+ }
+ return Dart_Null();
}
-void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) {
- return GetProcAddress(reinterpret_cast<HMODULE>(lib_handle), symbol);
+Dart_Handle Extensions::ResolveSymbol(void* lib_handle,
+ const char* symbol,
+ void** init_function) {
+ ASSERT(init_function != NULL);
+ *init_function = GetProcAddress(
+ reinterpret_cast<HMODULE>(lib_handle), symbol);
+ if (*init_function == NULL) {
+ OSError err;
+ return Dart_NewApiError(err.message());
+ }
+ return Dart_Null();
}
} // namespace bin

Powered by Google App Engine
This is Rietveld 408576698