Problem with compiling static libraries

Kai Nacke kai at
Tue Jul 2 13:02:58 PDT 2013

On Sunday, 30 June 2013 at 13:57:28 UTC, Mike Parker wrote:
> I've finally been playing around with LDC on Windows and I love 
> it so far. But I've run into something rather frustrating and I 
> don't know if it's a bug or by design.
> I'm using the MinGW backed version. The problem is that when I 
> compile a static library, LDC decides to automatically prepends 
> 'lib' and appends '.lib' to the output. That was really 
> unexpected. It breaks the build script I have for Derelict, 
> which handles library name formatting based on platform and 
> also drops all the libraries into a lib directory. DMD and GDC 
> do the right thing, but given this command:
> -ofC:\lib\libFoo.a
> The compiler errors out because it's truing to find 
> libC:\lib\libFoo.a.lib.
> I've been scrolling through compiler options and can't find 
> anything that allows me to set the output directory for the 
> binary. -od handles object files well enough, but doesn't put 
> the library there.
> Have I overlooked something? Is there a way to specify the 
> output directory for the binary?

Hi Mike!

Does the MingW tool chain use .a for static libs, too? Then the 
initialization of global.lib_ext is wrong. (It currently uses 
".lib" for all Windows targets.)


More information about the digitalmars-d-ldc mailing list