From 45dbc0d30e2447faeb877469c54a47579e56837c Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 29 Nov 2017 10:44:41 +0530 Subject: find_library: Prefer .dll.a and .lib over .dll for shared We can't know if the .lib is a static or import library, but that's a problem in general too. The only way to figure out if a specific file is an import or a static library is to dump its symbols and check if it starts with __imp or not. Even then, some libs are hybrid import and static, i.e., they contain references to DLLs for some symbols and also provide implementations for other symbols so this is a difficult problem. Closes https://github.com/mesonbuild/meson/issues/2659 --- mesonbuild/compilers/c.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mesonbuild/compilers/c.py') diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 317a4d7..2d12314 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -727,10 +727,12 @@ class CCompiler(Compiler): if for_darwin(env.is_cross_build(), env): shlibext = ['dylib'] elif for_windows(env.is_cross_build(), env): + # FIXME: .lib files can be import or static so we should read the + # file, figure out which one it is, and reject the wrong kind. if self.id == 'msvc': shlibext = ['lib'] else: - shlibext = ['dll', 'dll.a', 'lib'] + shlibext = ['dll.a', 'lib', 'dll'] # Yep, static libraries can also be foo.lib stlibext += ['lib'] elif for_cygwin(env.is_cross_build(), env): -- cgit v1.1