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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « runtime/bin/extensions.cc ('k') | runtime/bin/extensions_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include "bin/extensions.h" 8 #include "bin/extensions.h"
9 #include <dlfcn.h> // NOLINT 9 #include <dlfcn.h> // NOLINT
10 10
11 11
12 namespace dart { 12 namespace dart {
13 namespace bin { 13 namespace bin {
14 14
15 const char* kPrecompiledLibraryName = "libprecompiled.so"; 15 const char* kPrecompiledLibraryName = "libprecompiled.so";
16 const char* kPrecompiledSymbolName = "_kInstructionsSnapshot"; 16 const char* kPrecompiledSymbolName = "_kInstructionsSnapshot";
17 17
18 void* Extensions::LoadExtensionLibrary(const char* library_file) { 18 Dart_Handle Extensions::LoadExtensionLibrary(const char* library_file,
19 return dlopen(library_file, RTLD_LAZY); 19 void** library_handle) {
20 ASSERT(library_handle != NULL);
21 *library_handle = dlopen(library_file, RTLD_LAZY);
22 if (*library_handle == NULL) {
23 return Dart_NewApiError(dlerror());
24 }
25 return Dart_Null();
20 } 26 }
21 27
22 void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) { 28 Dart_Handle Extensions::ResolveSymbol(void* lib_handle,
29 const char* symbol,
30 void** init_function) {
31 ASSERT(init_function != NULL);
23 dlerror(); 32 dlerror();
24 void* result = dlsym(lib_handle, symbol); 33 *init_function = dlsym(lib_handle, symbol);
25 if (dlerror() != NULL) return NULL; 34 char* err_str = dlerror();
26 return result; 35 if (err_str != NULL) {
36 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
37 }
38 return Dart_Null();
27 } 39 }
28 40
29 } // namespace bin 41 } // namespace bin
30 } // namespace dart 42 } // namespace dart
31 43
32 #endif // defined(TARGET_OS_ANDROID) 44 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« 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