aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-12-02 21:55:56 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2016-12-02 21:55:56 +0200
commit6d84b9b6468eca57763895efe51347047ca3088d (patch)
tree2396bfa11ba04aac451df8091a66322a2d8110ae /test cases
parent7afb4c655281d60ef64d0378ff126a08f12a14ce (diff)
downloadmeson-6d84b9b6468eca57763895efe51347047ca3088d.zip
meson-6d84b9b6468eca57763895efe51347047ca3088d.tar.gz
meson-6d84b9b6468eca57763895efe51347047ca3088d.tar.bz2
Created new shared module build target type, and make sure -Wl,--no-undefined is not used when linking it.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/125 shared module/meson.build4
-rw-r--r--test cases/common/125 shared module/module.c22
2 files changed, 26 insertions, 0 deletions
diff --git a/test cases/common/125 shared module/meson.build b/test cases/common/125 shared module/meson.build
new file mode 100644
index 0000000..70e954b
--- /dev/null
+++ b/test cases/common/125 shared module/meson.build
@@ -0,0 +1,4 @@
+project('shared module', 'c')
+
+shared_module('mymodule', 'module.c')
+
diff --git a/test cases/common/125 shared module/module.c b/test cases/common/125 shared module/module.c
new file mode 100644
index 0000000..be0720d
--- /dev/null
+++ b/test cases/common/125 shared module/module.c
@@ -0,0 +1,22 @@
+#if defined _WIN32 || defined __CYGWIN__
+ #define DLL_PUBLIC __declspec(dllexport)
+#else
+ #if defined __GNUC__
+ #define DLL_PUBLIC __attribute__ ((visibility("default")))
+ #else
+ #pragma message ("Compiler does not support symbol visibility.")
+ #define DLL_PUBLIC
+ #endif
+#endif
+
+/*
+ * Shared modules often have references to symbols that are not defined
+ * at link time, but which will be provided by the executable that
+ * dlopens it. We need to make sure that this works, i.e. that we do
+ * not pass -Wl,--no-undefined when linking modules.
+ */
+int nonexisting_function();
+
+int DLL_PUBLIC func() {
+ return nonexisting_function();
+}