diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-02-15 09:05:10 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2016-03-30 16:24:35 +0530 |
commit | 1713fa02970ca2a045b1635186fef718620bf1b3 (patch) | |
tree | 6e0395fd46efec1338dab2db8f5b984e7115c1de /mesonbuild/compilers.py | |
parent | 8945c85f968e851010b101ac2654aa3758470589 (diff) | |
download | meson-1713fa02970ca2a045b1635186fef718620bf1b3.zip meson-1713fa02970ca2a045b1635186fef718620bf1b3.tar.gz meson-1713fa02970ca2a045b1635186fef718620bf1b3.tar.bz2 |
Add shared_library argument for a Visual Studio module definitions file
On MSVC, shared libraries only export symbols that have been explicitly exported
either as part of the symbol prototype or via a module definitions file.
On compilers other than MSVC, all symbols are exported in the shared library by
default and the format for the list of symbols to export is different, so this
is only used with the VisualStudio compiler.
The module defs file path can either be relative to the current source directory
or an absolute path using meson.source_root() + '/some/path'
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r-- | mesonbuild/compilers.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index f1868dd..ff2df56 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -1252,6 +1252,13 @@ class VisualStudioCCompiler(CCompiler): def get_std_shared_lib_link_args(self): return ['/DLL'] + def gen_vs_module_defs_args(self, defsfile): + if not isinstance(defsfile, str): + raise RuntimeError('Module definitions file should be str') + # With MSVC, DLLs only export symbols that are explicitly exported, + # so if a module defs file is specified, we use that to export symbols + return ['/DEF:' + defsfile] + def gen_pch_args(self, header, source, pchname): objname = os.path.splitext(pchname)[0] + '.obj' return (objname, ['/Yc' + header, '/Fp' + pchname, '/Fo' + objname ]) |