Apply magical flags to make OSX ignore missing symbols in plugins.
This commit is contained in:
parent
a5dcb89410
commit
b54fc1d00e
|
@ -2208,7 +2208,7 @@ class ClangCompiler():
|
|||
|
||||
def get_std_shared_module_link_args(self):
|
||||
if self.clang_type == CLANG_OSX:
|
||||
return ['-bundle']
|
||||
return ['-bundle', '-Wl,-undefined,dynamic_lookup']
|
||||
return ['-shared']
|
||||
|
||||
class ClangCCompiler(ClangCompiler, CCompiler):
|
||||
|
|
|
@ -2,18 +2,11 @@ project('shared module', 'c')
|
|||
|
||||
dl = meson.get_compiler('c').find_library('dl', required : false)
|
||||
l = shared_library('runtime', 'runtime.c')
|
||||
if host_machine.system() == 'darwin' or host_machine.system() == 'windows'
|
||||
# At least in OSX and seemingly also on Windows you must have
|
||||
# all symbols present when linking a module.
|
||||
#
|
||||
# In Linux many projects build plugins without linking to
|
||||
# the runtime so they have undefined symbols. We need to support
|
||||
# both for ease of transitioning.
|
||||
mlink = [l]
|
||||
else
|
||||
mlink = []
|
||||
endif
|
||||
m = shared_module('mymodule', 'module.c', link_with : mlink)
|
||||
# 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
|
||||
m = shared_module('mymodule', 'module.c')
|
||||
e = executable('prog', 'prog.c', link_with : l, dependencies : dl)
|
||||
test('import test', e, args : [m.full_path()])
|
||||
|
||||
|
|
Loading…
Reference in New Issue