On Monday, 2 March 2015 at 01:22:58 UTC, ketmar wrote:
On Sun, 01 Mar 2015 22:40:28 +0000, Taylor Hillegeist wrote:

But still the question was about smaller executable when compiling d code. The linker needs to know which .o files to include, the pascal
notation is basically:

uses
  thisBigoleThing, ThisOtherBigOleThing, AndMeToo;

I assume the linker just auto-magically includes the entire thing even if your only using a single function or value from each. Then again
perhaps I am wrong.

FreePascal learnt the "smart linking" trick years ago, so only actually used functions ends in linked binary. but LCL is very big library, and FPC can't drop out unused virtual methods, so resulting binaries are big.

with D we have the same situation, maybe even worse due to template instantiation. compiler is able to merge identical template instanses, but... empty `void main () {}` is ~200 KB in D (GNU/Linux, x86). adding simple `import std.stdio : writeln;` increases binary size to ~300 KB. and adding `writeln("hello!");` increases binary size to ~350 KB.

D binaries are big. ;-)

LDC + dynamic linking gets pretty tiny binaries, C binaries aren't all that small if you static link in glibc ;)

Reply via email to