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

Side by Side Diff: runtime/bin/extensions_linux.cc

Issue 1403613005: Fix build bot error. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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_android.cc ('k') | runtime/bin/extensions_macos.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/assert.h" 5 #include "platform/assert.h"
6 #include "platform/globals.h" 6 #include "platform/globals.h"
7 #if defined(TARGET_OS_LINUX) 7 #if defined(TARGET_OS_LINUX)
8 8
9 #include "bin/extensions.h" 9 #include "bin/extensions.h"
10 #include <dlfcn.h> // NOLINT 10 #include <dlfcn.h> // NOLINT
11 11
12 12
13 namespace dart { 13 namespace dart {
14 namespace bin { 14 namespace bin {
15 15
16 const char* kPrecompiledLibraryName = "libprecompiled.so"; 16 const char* kPrecompiledLibraryName = "libprecompiled.so";
17 const char* kPrecompiledSymbolName = "_kInstructionsSnapshot"; 17 const char* kPrecompiledSymbolName = "_kInstructionsSnapshot";
18 18
19 Dart_Handle Extensions::LoadExtensionLibrary(const char* library_file, 19 Dart_Handle Extensions::LoadExtensionLibrary(const char* library_file,
20 void** library_handle) { 20 void** library_handle) {
21 ASSERT(library_handle != NULL); 21 ASSERT(library_handle != NULL);
22 *library_handle = dlopen(library_file, RTLD_LAZY); 22 *library_handle = dlopen(library_file, RTLD_LAZY);
23 if (*library_handle == NULL) { 23 if (*library_handle == NULL) {
24 return Dart_NewApiError(dlerror()); 24 return Dart_NewApiError(dlerror());
25 } 25 }
26 return Dart_Null(); 26 return Dart_Null();
27 } 27 }
28 28
29 void* Extensions::LoadExtensionLibrary(const char* library_file) {
30 return dlopen(library_file, RTLD_LAZY);
31 }
32
29 Dart_Handle Extensions::ResolveSymbol(void* lib_handle, 33 Dart_Handle Extensions::ResolveSymbol(void* lib_handle,
30 const char* symbol, 34 const char* symbol,
31 void** init_function) { 35 void** init_function) {
32 ASSERT(init_function != NULL); 36 ASSERT(init_function != NULL);
33 dlerror(); 37 dlerror();
34 *init_function = dlsym(lib_handle, symbol); 38 *init_function = dlsym(lib_handle, symbol);
35 char* err_str = dlerror(); 39 char* err_str = dlerror();
36 if (err_str != NULL) { 40 if (err_str != NULL) {
37 return Dart_NewApiError(err_str); 41 return Dart_NewApiError(err_str);
38 } 42 }
39 return Dart_Null(); 43 return Dart_Null();
40 } 44 }
41 45
46 void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) {
47 dlerror();
48 void* result = dlsym(lib_handle, symbol);
49 if (dlerror() != NULL) return NULL;
50 return result;
51 }
52
42 } // namespace bin 53 } // namespace bin
43 } // namespace dart 54 } // namespace dart
44 55
45 #endif // defined(TARGET_OS_LINUX) 56 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/bin/extensions_android.cc ('k') | runtime/bin/extensions_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698