[vlc-devel] [PATCH] package: win32: Don't use linker script for import libraries

Martin Storsjö martin at martin.st
Wed Oct 9 11:56:44 CEST 2019

On Wed, 9 Oct 2019, Steve Lhomme wrote:

> Aren't these .lib compatible with MSVC ? Meaning a program built in MSVC 
> could link to libvlc even if VLC was not built with it.

Yes they are compatible with MSVC.

Currently, there's four files produced:


The first two are import libs, produced by dlltool, which can be linked by 
both MSVC and binutils.

The last two are linker scripts, not actual libraries, which only contain 
the text "INPUT(libvlc.lib)", acting as a redirection. MSVC does not 
support this, and lld in coff mode doesn't either. Only GNU ld supports 

When you specify -lvlc for linking, GNU ld doesn't look for "libvlc.lib", 
it does look for "libvlc.a", "libvlc.dll.a" and "vlc.lib" (and a number of 
other combinations). To fix this, 4ab7dfbf8fc added "vlc.lib" in addition 
to "libvlc.lib", with the linker script redirection.

But I think this is bad for two reasons:
1) The name "vlc.lib" makes it sound like this also is a library for MSVC 
(and how is an MSVC user going to know which to pick between "libvlc.lib" 
and "vlc.lib"?), while it only works with GNU ld. By renaming it from 
"vlc.lib" to "libvlc.dll.a" it's clearer what its purpose is (to be picked 
up by mingw linkers)
2) lld/coff doesn't support linker script for the redirection, so we can 
replace it with a copy instead of a linker script, to make it work with 
lld as well.

// Martin

More information about the vlc-devel mailing list