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

Unified Diff: base/native_library_test_library.cc

Issue 2277863002: Enable loading native libraries with RTLD_DEEPBIND (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enable loading native libraries with RTLD_DEEPBIND Created 4 years, 4 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
Index: base/native_library_test_library.cc
diff --git a/base/native_library_test_library.cc b/base/native_library_test_library.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9fd7fe2c75594f78ddef02753c3a765293927b28
--- /dev/null
+++ b/base/native_library_test_library.cc
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "build/build_config.h"
+
+#if defined(OS_WIN)
+#define EXPORT __declspec(dllexport)
+#else
+#define EXPORT __attribute__((visibility("default")))
+#endif
+
+extern "C" {
+
+// This variable name must match the exported variable in
+// native_library_unittest.cc.
+int EXPORT g_native_library_exported_value = 0;
+
+int EXPORT GetExportedValue() {
+ return g_native_library_exported_value;
+}
+
+void EXPORT SetExportedValue(int value) {
+ g_native_library_exported_value = value;
+}
+
+// This function name must match the exported function with the same signature
+// in native_library_unittest.cc. This function must return a different value
+// from the one defined there.
+int EXPORT GetNativeLibraryTestMagicValue() { return 42; }
+
+int EXPORT GetMagicValue() {
+ // When called by NativeLibraryTest.LoadLibraryPreferOwnSymbols, this should
+ // resolve to the local definition, even though the test module exports
+ // another symbol with the same name.
+ return GetNativeLibraryTestMagicValue();
+}
+
+int EXPORT GetSimpleTestValue() {
+ return 5;
+}
+
+} // extern "C"

Powered by Google App Engine
This is Rietveld 408576698