From a5dcb89410973f4bfa872cd58616272355638963 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 3 Dec 2016 16:11:34 +0200 Subject: [PATCH] Link against runtime on OSX and Windows because they seem to insist on all symbols being present. --- test cases/common/125 shared module/meson.build | 13 ++++++++++++- test cases/common/125 shared module/runtime.c | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/test cases/common/125 shared module/meson.build b/test cases/common/125 shared module/meson.build index 5ca50c5e2..44abf55ee 100644 --- a/test cases/common/125 shared module/meson.build +++ b/test cases/common/125 shared module/meson.build @@ -2,7 +2,18 @@ project('shared module', 'c') dl = meson.get_compiler('c').find_library('dl', required : false) l = shared_library('runtime', 'runtime.c') -m = shared_module('mymodule', 'module.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) e = executable('prog', 'prog.c', link_with : l, dependencies : dl) test('import test', e, args : [m.full_path()]) diff --git a/test cases/common/125 shared module/runtime.c b/test cases/common/125 shared module/runtime.c index f701171fd..68c813a4d 100644 --- a/test cases/common/125 shared module/runtime.c +++ b/test cases/common/125 shared module/runtime.c @@ -14,6 +14,6 @@ * modules. */ -int func_from_language_runtime() { +int DLL_PUBLIC func_from_language_runtime() { return 86; }