summaryrefslogtreecommitdiff
path: root/test cases/common/117 shared module/meson.build
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-04-26 16:52:13 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2021-04-26 23:39:15 +0100
commite75e3976facda7de244fbb9a02eebf0d043ea1c8 (patch)
treedab22f95b5c837a70b1b4164d97ff351a49ffd81 /test cases/common/117 shared module/meson.build
parent53fe7c2f0a51697cd57628753852dd3f8711becf (diff)
downloadmeson-e75e3976facda7de244fbb9a02eebf0d043ea1c8.tar.gz
Condense test directory names.
Diffstat (limited to 'test cases/common/117 shared module/meson.build')
-rw-r--r--test cases/common/117 shared module/meson.build40
1 files changed, 40 insertions, 0 deletions
diff --git a/test cases/common/117 shared module/meson.build b/test cases/common/117 shared module/meson.build
new file mode 100644
index 000000000..936c8396f
--- /dev/null
+++ b/test cases/common/117 shared module/meson.build
@@ -0,0 +1,40 @@
+project('shared module', 'c')
+
+c = meson.get_compiler('c')
+
+# Windows UWP doesn't support the ToolHelp API we use in this test to emulate
+# runtime symbol resolution.
+if host_machine.system() == 'windows'
+ if not c.compiles('''
+#include <windows.h>
+#include <tlhelp32.h>
+
+HANDLE func(void)
+{
+ return CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, 0);
+}
+''')
+ error('MESON_SKIP_TEST Windows UWP does not support this test.')
+ endif
+endif
+
+dl = c.find_library('dl', required : false)
+l = shared_library('runtime', 'runtime.c')
+# Do NOT link the module with the runtime library. This
+# is a common approach for plugins that are only used
+# with dlopen. Any symbols are resolved dynamically
+# at runtime. This requires extra help on Windows, so
+# should be avoided unless really necessary.
+m = shared_module('mymodule', 'module.c')
+e = executable('prog', 'prog.c',
+ link_with : l, export_dynamic : true, dependencies : dl)
+test('import test', e, args : m)
+
+# Same as above, but module created with build_target()
+m2 = build_target('mymodule2', 'module.c', target_type: 'shared_module')
+test('import test 2', e, args : m2)
+
+# Shared module that does not export any symbols
+shared_module('nosyms', 'nosyms.c',
+ install : true,
+ install_dir : join_paths(get_option('libdir'), 'modules'))