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

Unified Diff: runtime/bin/test_extension.cc

Issue 9465004: Add native extensions for the Dart shell to mac and windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use shared library (dylib) on Mac (and therefore for all platforms). Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/extensions_win.cc ('k') | runtime/bin/test_extension_dllmain_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/test_extension.cc
diff --git a/runtime/bin/test_extension_linux.cc b/runtime/bin/test_extension.cc
similarity index 53%
rename from runtime/bin/test_extension_linux.cc
rename to runtime/bin/test_extension.cc
index 7a7d6bc24e62b2423bcc9ea96ae711ac808cb475..623e151fc9ef0f9b23b856db04e3732b8b1b2917 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_NativeFunction ResolveName(Dart_Handle name, int argc);
-#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;
}
-extern "C" void IfNull(Dart_NativeArguments arguments) {
+void IfNull(Dart_NativeArguments arguments) {
Dart_Handle object = Dart_GetNativeArgument(arguments, 0);
if (Dart_IsNull(object)) {
Dart_SetReturnValue(arguments, Dart_GetNativeArgument(arguments, 1));
@@ -26,7 +25,7 @@ extern "C" void IfNull(Dart_NativeArguments arguments) {
}
}
-extern "C" Dart_NativeFunction ResolveName(Dart_Handle name, int argc) {
+Dart_NativeFunction ResolveName(Dart_Handle name, int argc) {
assert(Dart_IsString8(name));
const char* cname;
Dart_Handle check_error;
@@ -35,7 +34,7 @@ extern "C" Dart_NativeFunction ResolveName(Dart_Handle name, int argc) {
if (Dart_IsError(check_error)) {
Dart_PropagateError(check_error);
}
- if (!strcmp("Cat_IfNull", cname) && argc == 2) {
+ if (!strcmp("TestExtension_IfNull", cname) && argc == 2) {
return IfNull;
}
return NULL;
« no previous file with comments | « runtime/bin/extensions_win.cc ('k') | runtime/bin/test_extension_dllmain_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698