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

Unified Diff: runtime/bin/extensions_macos.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_linux.cc ('k') | runtime/bin/extensions_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/extensions_macos.cc
diff --git a/runtime/bin/extensions_macos.cc b/runtime/bin/extensions_macos.cc
index d81e670eef10218fe7bc68228faa4d0d88a9083c..92d33602555a8e7bd962083059ad6d9d5c556f2f 100644
--- a/runtime/bin/extensions_macos.cc
+++ b/runtime/bin/extensions_macos.cc
@@ -3,12 +3,18 @@
// BSD-style license that can be found in the LICENSE file.
#include "bin/extensions.h"
+#include <dlfcn.h>
-#include "include/dart_api.h"
-#include "platform/assert.h"
+void* Extensions::LoadExtensionLibrary(const char* library_name) {
+ const char* strings[4] = { "./lib", library_name, ".dylib", NULL };
+ char* library_path = Concatenate(strings);
+ void* lib_handle = dlopen(library_path, RTLD_LAZY);
+ free(library_path);
+ return lib_handle;
+}
-Dart_Handle Extensions::LoadExtension(const char* extension_url,
- Dart_Handle parent_library) {
- UNIMPLEMENTED();
- return NULL;
+void* Extensions::ResolveSymbol(void* lib_handle, const char* symbol) {
+ void* result = dlsym(lib_handle, symbol);
+ if (dlerror() != NULL) return NULL;
+ return result;
}
« no previous file with comments | « runtime/bin/extensions_linux.cc ('k') | runtime/bin/extensions_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698