Debian Codegraph @

test cases/common/148 shared module resolving symbol in executable/meson.build

raw
1 project('shared module resolving symbol in executable', 'c')
2
3 # The shared module contains a reference to the symbol 'func_from_executable',
4 # which is always provided by the executable which loads it. This symbol can be
5 # resolved at run-time by an ELF loader. But when building PE/COFF objects, all
6 # symbols must be resolved at link-time, so an implib is generated for the
7 # executable, and the shared module linked with it.
8 #
9 # See testcase 125 for an example of the more complex portability gymnastics
10 # required if we do not know (at link-time) what provides the symbol.
11
12 cc = meson.get_compiler('c')
13 if cc.get_id() == 'pgi'
14 error('MESON_SKIP_TEST PGI has its own unique set of macros that would need to be handled')
15 endif
16
17 dl = meson.get_compiler('c').find_library('dl', required: false)
18 e = executable('prog', 'prog.c', dependencies: dl, export_dynamic: true)
19 e_dep = declare_dependency(link_with: e)
20
21 m = shared_module('module', 'module.c', link_with: e)
22 m2 = shared_module('module2', 'module.c', dependencies: e_dep)
23
24 test('test', e, args: m.full_path())
25 test('test2', e, args: m2.full_path())