Chromium Code Reviews| Index: runtime/bin/test_extension.cc |
| diff --git a/runtime/bin/test_extension_linux.cc b/runtime/bin/test_extension.cc |
| similarity index 52% |
| rename from runtime/bin/test_extension_linux.cc |
| rename to runtime/bin/test_extension.cc |
| index dc3a67be7e096de3f1adb3da5892ea70c66a2d3e..46f7e4a6f39fa80bffac87dead697eb4ee45a496 100644 |
| --- a/runtime/bin/test_extension_linux.cc |
| +++ b/runtime/bin/test_extension.cc |
| @@ -1,23 +1,22 @@ |
| // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| // 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 <string.h> |
| -#include "../include/dart_api.h" |
| +#include "include/dart_api.h" |
| + |
| +DART_EXTERN_C Dart_NativeFunction ResolveName(Dart_Handle name, int argc); |
|
Bill Hesse
2012/03/07 14:11:30
Remove dart_extern_c
|
| -#define EXPORT_SYMBOL __attribute__ ((visibility ("default"))) |
| +DART_EXPORT Dart_Handle test_extension_Init(Dart_Handle parent_library) { |
| + if (Dart_IsError(parent_library)) { return parent_library; } |
| -extern "C" Dart_NativeFunction ResolveName(Dart_Handle name, int argc); |
| + Dart_Handle result_code = Dart_SetNativeResolver(parent_library, ResolveName); |
| + if (Dart_IsError(result_code)) return result_code; |
| -extern "C" EXPORT_SYMBOL Dart_Handle test_extension_Init(Dart_Handle library) { |
| - if (Dart_IsError(library)) return library; |
| - Dart_Handle check_return = Dart_SetNativeResolver(library, ResolveName); |
| - if (Dart_IsError(check_return)) return check_return; |
| - return Dart_Null(); |
| + return parent_library; |
| } |
|
Bill Hesse
2012/03/07 14:11:30
Also here
|
| -extern "C" void IfNull(Dart_NativeArguments arguments) { |
| +DART_EXTERN_C void IfNull(Dart_NativeArguments arguments) { |
| Dart_Handle object = Dart_GetNativeArgument(arguments, 0); |
| if (Dart_IsNull(object)) { |
| Dart_SetReturnValue(arguments, Dart_GetNativeArgument(arguments, 1)); |
| @@ -26,14 +25,14 @@ extern "C" void IfNull(Dart_NativeArguments arguments) { |
| } |
| } |
| -extern "C" Dart_NativeFunction ResolveName(Dart_Handle name, int argc) { |
| +DART_EXTERN_C Dart_NativeFunction ResolveName(Dart_Handle name, int argc) { |
|
Bill Hesse
2012/03/07 14:11:30
And here.
|
| assert(Dart_IsString8(name)); |
| const char* cname; |
| Dart_Handle check_error; |
| check_error = Dart_StringToCString(name, &cname); |
| if (Dart_IsError(check_error)) return NULL; |
| - if (!strcmp("Cat_IfNull", cname) && argc == 2) { |
| + if (!strcmp("TestExtension_IfNull", cname) && argc == 2) { |
| return IfNull; |
| } |
| return NULL; |