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

Unified Diff: runtime/bin/extensions_android.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: self-review-comments 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
« no previous file with comments | « runtime/bin/extensions.cc ('k') | runtime/bin/extensions_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/extensions_android.cc
diff --git a/runtime/bin/extensions_android.cc b/runtime/bin/extensions_android.cc
index 1b7999169d0bcdb309a67e975cd10519eedd6f2a..811c70058638dd574641c418a9cde84aa5a53430 100644
--- a/runtime/bin/extensions_android.cc
+++ b/runtime/bin/extensions_android.cc
@@ -15,15 +15,27 @@ namespace bin {
const char* kPrecompiledLibraryName = "libprecompiled.so";
const char* kPrecompiledSymbolName = "_kInstructionsSnapshot";
-void* Extensions::LoadExtensionLibrary(const char* library_file) {
- return dlopen(library_file, RTLD_LAZY);
+Dart_Handle Extensions::LoadExtensionLibrary(const char* library_file,
+ void** library_handle) {
+ ASSERT(library_handle != NULL);
+ *library_handle = dlopen(library_file, RTLD_LAZY);
+ if (*library_handle == NULL) {
+ return Dart_NewApiError(dlerror());
+ }
+ return Dart_Null();
}
-void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) {
+Dart_Handle Extensions::ResolveSymbol(void* lib_handle,
+ const char* symbol,
+ void** init_function) {
+ ASSERT(init_function != NULL);
dlerror();
- void* result = dlsym(lib_handle, symbol);
- if (dlerror() != NULL) return NULL;
- return result;
+ *init_function = dlsym(lib_handle, symbol);
+ char* err_str = dlerror();
+ if (err_str != NULL) {
+ return Dart_NewApiError(err_str);
Søren Gjesse 2015/10/14 07:00:25 Drop the temp err_str like above?
siva 2015/10/14 18:13:19 It is not possible to drop the temp err_str, see c
+ }
+ return Dart_Null();
}
} // namespace bin
« no previous file with comments | « runtime/bin/extensions.cc ('k') | runtime/bin/extensions_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698