March 23, 2016
Hi Russel,

On 20 Mar 2016, at 4:57, Russel Winder via digitalmars-d-ldc wrote:
> […] I tried removing the -defaultlib option from the link and replaced it
> with: -L-lphobos2-ldc

-defaultlib/-debuglib are mainly intended to be used for setting defaults from the config file. To disable that and only use the explicitly specified libraries, you can pass it with an empty argument.

> I am clearly misunderstanding something about dynamic linking and the
> -defaultlib here, and in particular the difference between dmd and
> ldc2.

The difference is that DMD parses any `-l` arguments and ignores `lib` prefixes, `.so` suffixes and on `.a` suffixes passes `-Bstatic` to the linker before the respective `-l` argument.

> Is this a simple issue I am missing, or is it something needing
> detail research?

LDC does not currently implement a way to specifically switch between statically/dynamically linking the standard library. You can either manually specify `-L-Bstatic`, or have a look at https://github.com/ldc-developers/ldc/pull/1305.

Best,
David
March 28, 2016
On 03/23/2016 11:02 PM, David Nadlinger via digitalmars-d-ldc wrote:
> 
> The difference is that DMD parses any `-l` arguments and ignores `lib` prefixes, `.so` suffixes and on `.a` suffixes passes `-Bstatic` to the linker before the respective `-l` argument.

Actually we were using -l:libphobos2.a and -l:libphobos2.so before, but
this didn't work w/ older ld versions, so I implemented this in the
linker code.
https://github.com/D-Programming-Language/dmd/pull/4975/commits/94c66eaa298c23c730df1de075efb8e6210c693f