hello world in D

Regan Heath regan at netmail.co.nz
Fri May 31 08:03:58 PDT 2013


On Fri, 31 May 2013 16:00:00 +0100, Adam D. Ruppe  
<destructionator at gmail.com> wrote:
> On Friday, 31 May 2013 at 14:48:12 UTC, Regan Heath wrote:
>> You  will get a similar size (or greater) if you statically link the  
>> stdc library.
>
> That's not necessarily true because static linking only pulls functions  
> that are actually used by the program....
>
> even though I just tried gcc hello.c -static, and got a beefy 600 KB  
> binary out of it, so maybe it is more intertwined than I thought!

It is a bit surprising isn't it.

>> Eventually D will support dynamically linking to Phobos.
>
> I think it is worth remembering that this doesn't actually reduce the  
> size. In fact, it will increase it since the dynamic linked library  
> needs all functions. The phobos.dll will be probably two or three  
> megabytes, and if you are distributing a D app, you'll still have to  
> offer that file... and now have the hassle of dependency management.
>
> Dynamic linking might look less scary when your ls sees 20 KB instead of  
> 600 but it doesn't really change anything substantial.

Agreed 100%.  But newcomers don't often get that far down the chain of  
thought, they just see a huge exe and wonder WTF! :)  The short answer is  
"it's statically linked" and the longer answer is.. as you say, there are  
pros/cons to each and we have issues in D around the GC and how that would  
work in a dynamically linked situation IIRC.

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list