meson.build 809 B

12345678910111213141516
  1. project('shared module resolving symbol in executable', 'c')
  2. # The shared module contains a reference to the symbol 'func_from_executable',
  3. # which is always provided by the executable which loads it. This symbol can be
  4. # resolved at run-time by an ELF loader. But when building PE/COFF objects, all
  5. # symbols must be resolved at link-time, so an implib is generated for the
  6. # executable, and the shared module linked with it.
  7. #
  8. # See testcase 125 for an example of the more complex portability gymnastics
  9. # required if we do not know (at link-time) what provides the symbol.
  10. dl = meson.get_compiler('c').find_library('dl', required: false)
  11. e = executable('prog', 'prog.c', dependencies: dl, export_dynamic: true)
  12. m = shared_module('module', 'module.c', link_with: e)
  13. test('test', e, args: m.full_path())