Chromium Code Reviews| 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/assert.h" | |
| 5 #include "platform/globals.h" | 6 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_ANDROID) | 7 #if defined(TARGET_OS_ANDROID) |
| 7 | 8 |
| 8 #include "bin/extensions.h" | 9 #include "bin/extensions.h" |
| 9 #include <dlfcn.h> // NOLINT | 10 #include <dlfcn.h> // NOLINT |
| 10 | 11 |
| 11 | 12 |
| 12 namespace dart { | 13 namespace dart { |
| 13 namespace bin { | 14 namespace bin { |
| 14 | 15 |
| 15 const char* kPrecompiledLibraryName = "libprecompiled.so"; | 16 const char* kPrecompiledLibraryName = "libprecompiled.so"; |
| 16 const char* kPrecompiledSymbolName = "_kInstructionsSnapshot"; | 17 const char* kPrecompiledSymbolName = "_kInstructionsSnapshot"; |
| 17 | 18 |
| 18 void* Extensions::LoadExtensionLibrary(const char* library_file) { | 19 Dart_Handle Extensions::LoadExtensionLibrary(const char* library_file, |
| 19 return dlopen(library_file, RTLD_LAZY); | 20 void** library_handle) { |
| 21 ASSERT(library_handle != NULL); | |
| 22 *library_handle = dlopen(library_file, RTLD_LAZY); | |
| 23 if (*library_handle == NULL) { | |
| 24 return Dart_NewApiError(dlerror()); | |
| 25 } | |
| 26 return Dart_Null(); | |
| 20 } | 27 } |
| 21 | 28 |
| 22 void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) { | 29 Dart_Handle Extensions::ResolveSymbol(void* lib_handle, |
| 30 const char* symbol, | |
| 31 void** init_function) { | |
| 32 ASSERT(init_function != NULL); | |
| 23 dlerror(); | 33 dlerror(); |
| 24 void* result = dlsym(lib_handle, symbol); | 34 *init_function = dlsym(lib_handle, symbol); |
| 25 if (dlerror() != NULL) return NULL; | 35 char* err_str = dlerror(); |
|
jamesr
2015/10/14 23:55:39
This produces the following error in the Flutter b
siva
2015/10/15 00:27:45
Will fix this in the Dart repo, I thought our warn
| |
| 26 return result; | 36 if (err_str != NULL) { |
| 37 return Dart_NewApiError(err_str); | |
| 38 } | |
| 39 return Dart_Null(); | |
| 27 } | 40 } |
| 28 | 41 |
| 29 } // namespace bin | 42 } // namespace bin |
| 30 } // namespace dart | 43 } // namespace dart |
| 31 | 44 |
| 32 #endif // defined(TARGET_OS_ANDROID) | 45 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |