Would Lcl be better if it was in D?

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 1 17:22:58 PST 2015


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. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150302/f6922bd3/attachment.sig>


More information about the Digitalmars-d mailing list