Does dmd use static or dynamic linking with the Phobos Library?

Jacob Carlborg doob at me.com
Tue May 1 03:01:26 PDT 2012


On 2012-05-01 04:46, WhatMeWorry wrote:
>
> Is this user configurable? I came across the sentence in the D
> Compiler/Linking section:
>
> "The actual linking is done by running gcc"
>
> I thought that maybe this meant that I could pass a gcc option like
> -static or -shared through dmd, but it errored out.

Unfortunately you cannot pass GCC options. You can only pass linker 
options using the -L flag. So if you pass:

dmd -L-foo

DMD will translate that to:

gcc -Xlinker -foo

Note that DMD has the -shared flag. But the runtime isn't capable to 
handle dynamic libraries.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list