summaryrefslogtreecommitdiff
path: root/test cases/unit
diff options
context:
space:
mode:
authorchitranjali <chitranjali189@gmail.com>2018-03-21 14:19:36 +0530
committerchitranjali <chitranjali189@gmail.com>2018-03-29 13:26:32 +0530
commit83766313a71e79fd81bc6d89cabdb21f90fc3251 (patch)
tree2a4ec073bbd1a1d64c20f5367ce3190b90abf759 /test cases/unit
parentb4aee4675afd9f9f4a36aea628bab4249d7addbc (diff)
downloadmeson-83766313a71e79fd81bc6d89cabdb21f90fc3251.tar.gz
fix2865
Diffstat (limited to 'test cases/unit')
-rw-r--r--test cases/unit/25 shared_mod linking/installed_files.txt1
-rw-r--r--test cases/unit/25 shared_mod linking/libfile.c14
-rw-r--r--test cases/unit/25 shared_mod linking/main.c11
-rw-r--r--test cases/unit/25 shared_mod linking/meson.build6
4 files changed, 32 insertions, 0 deletions
diff --git a/test cases/unit/25 shared_mod linking/installed_files.txt b/test cases/unit/25 shared_mod linking/installed_files.txt
new file mode 100644
index 000000000..c7dab9f6f
--- /dev/null
+++ b/test cases/unit/25 shared_mod linking/installed_files.txt
@@ -0,0 +1 @@
+usr/bin/prog?exe
diff --git a/test cases/unit/25 shared_mod linking/libfile.c b/test cases/unit/25 shared_mod linking/libfile.c
new file mode 100644
index 000000000..44f7667d4
--- /dev/null
+++ b/test cases/unit/25 shared_mod linking/libfile.c
@@ -0,0 +1,14 @@
+#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
+
+int DLL_PUBLIC func() {
+ return 0;
+}
diff --git a/test cases/unit/25 shared_mod linking/main.c b/test cases/unit/25 shared_mod linking/main.c
new file mode 100644
index 000000000..12f9c984b
--- /dev/null
+++ b/test cases/unit/25 shared_mod linking/main.c
@@ -0,0 +1,11 @@
+#if defined _WIN32 || defined __CYGWIN__
+ #define DLL_IMPORT __declspec(dllimport)
+#else
+ #define DLL_IMPORT
+#endif
+
+int DLL_IMPORT func();
+
+int main(int argc, char **arg) {
+ return func();
+}
diff --git a/test cases/unit/25 shared_mod linking/meson.build b/test cases/unit/25 shared_mod linking/meson.build
new file mode 100644
index 000000000..d8934e948
--- /dev/null
+++ b/test cases/unit/25 shared_mod linking/meson.build
@@ -0,0 +1,6 @@
+project('shared library linking test', 'c', 'cpp')
+
+lib = shared_module('mylib',
+ 'libfile.c' # Split to different lines before and after the comma to test parser.
+ , install : false) # Don't install libraries in common tests; the path is platform-specific
+exe = executable('prog', 'main.c', link_with : lib, install : true) \ No newline at end of file