| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
| 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 namespace dart { | 11 namespace dart { |
| 12 namespace bin { | 12 namespace bin { |
| 13 | 13 |
| 14 const char* kPrecompiledLibraryName = "libprecompiled.so"; | 14 const char* kPrecompiledVMIsolateSymbolName = "_kVmIsolateSnapshot"; |
| 15 const char* kPrecompiledIsolateSymbolName = "_kIsolateSnapshot"; |
| 15 const char* kPrecompiledInstructionsSymbolName = "_kInstructionsSnapshot"; | 16 const char* kPrecompiledInstructionsSymbolName = "_kInstructionsSnapshot"; |
| 16 const char* kPrecompiledDataSymbolName = "_kDataSnapshot"; | 17 const char* kPrecompiledDataSymbolName = "_kDataSnapshot"; |
| 17 | 18 |
| 18 void* Extensions::LoadExtensionLibrary(const char* library_file) { | 19 void* Extensions::LoadExtensionLibrary(const char* library_file) { |
| 19 return dlopen(library_file, RTLD_LAZY); | 20 return dlopen(library_file, RTLD_LAZY); |
| 20 } | 21 } |
| 21 | 22 |
| 22 void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) { | 23 void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) { |
| 23 dlerror(); | 24 dlerror(); |
| 24 return dlsym(lib_handle, symbol); | 25 return dlsym(lib_handle, symbol); |
| 25 } | 26 } |
| 26 | 27 |
| 27 Dart_Handle Extensions::GetError() { | 28 Dart_Handle Extensions::GetError() { |
| 28 const char* err_str = dlerror(); | 29 const char* err_str = dlerror(); |
| 29 if (err_str != NULL) { | 30 if (err_str != NULL) { |
| 30 return Dart_NewApiError(err_str); | 31 return Dart_NewApiError(err_str); |
| 31 } | 32 } |
| 32 return Dart_Null(); | 33 return Dart_Null(); |
| 33 } | 34 } |
| 34 | 35 |
| 35 } // namespace bin | 36 } // namespace bin |
| 36 } // namespace dart | 37 } // namespace dart |
| 37 | 38 |
| 38 #endif // defined(TARGET_OS_FUCHSIA) | 39 #endif // defined(TARGET_OS_FUCHSIA) |
| OLD | NEW |