Generated binary size

Dicebot public at dicebot.lv
Fri Sep 13 06:27:32 PDT 2013


On Friday, 13 September 2013 at 13:25:03 UTC, Dicebot wrote:
> It is exactly what `gdc -fdata-sections -Xlinker --gc-sections 
> app.d` will do.
>
> Be careful though, if you use dynamic loading of shared 
> libraries (or build your app as library) that may result in 
> weird stuff when applied to all sources :)

On my machine:

-----
$ cat a.d
immutable long[100_000] arr = 1;

void main()
{
}
----
$ gdc -O3 a.d
$ ls -la
# ...
-rwxr-xr-x 1 dicebot users 1276934 Sep 13 15:21 a.out
----
$ gdc -O3 -fdata-sections a.d -Xlinker --gc-sections
$ ls -la
# ...
-rwxr-xr-x 1 dicebot users 434859 Sep 13 15:21 a.out
----


More information about the D.gnu mailing list