| Index: runtime/bin/extensions_macos.cc
|
| diff --git a/runtime/bin/extensions_macos.cc b/runtime/bin/extensions_macos.cc
|
| index 92a5e98cc216ec13291a73bc59a46c1920e26dad..1d6a5f6c321ddb434127c272a3a3a12d8fa0e970 100644
|
| --- a/runtime/bin/extensions_macos.cc
|
| +++ b/runtime/bin/extensions_macos.cc
|
| @@ -2,6 +2,7 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| +#include "platform/assert.h"
|
| #include "platform/globals.h"
|
| #if defined(TARGET_OS_MACOS)
|
|
|
| @@ -15,15 +16,27 @@ namespace bin {
|
| const char* kPrecompiledLibraryName = "libprecompiled.dylib";
|
| 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);
|
| + }
|
| + return Dart_Null();
|
| }
|
|
|
| } // namespace bin
|
|
|