Compiler: Size of generated executable file

Steven Schveighoffer schveiguy at yahoo.com
Tue Jan 12 23:02:41 PST 2010


On Tue, 12 Jan 2010 22:16:53 -0500, dsimcha <dsimcha at yahoo.com> wrote:

> == Quote from Adam D. Ruppe (destructionator at gmail.com)'s article
>> I'm generally for static linking anything that isn't part of the base OS
>> install, just to ease the process for end users.
>
> One thing that has escaped discussion in the static vs. dynamic linking  
> debate so
> far is **templates**.  If you use template-heavy code all over your  
> library, that
> pretty much rules out dynamic linking.  If you avoid templates so you can
> dynamically link, you're avoiding IMHO the single most important feature  
> that
> distinguishes D from other languages and are writing non-idiomatic D.   
> You may as
> well use some other language that's better suited to doing things without
> templates.  Therefore, I suspect D culture will be very biased toward  
> static
> linking for that reason.

dynamic linking does not prevent template use.  The C++ standard library  
which arguably contains mostly templates still has a .so size of 900k on  
my linux box.

You would most likely be using many templates that are already  
instantiated by phobos in the dynamic library.  Anything specialized will  
be compiled into your app.  You can have it both ways!

-Steve



More information about the Digitalmars-d mailing list