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. ;-)
That seems like alot of KB for just a little bit of code. I
wasn't aware that void main(){} was anything but entry pointer...
;; pseudo-assembly-language
;; main(argc, argv, envp); call
push envp ;; rightmost argument
push argv ;;
push argc ;; leftmost argument ends up on top of stack
call main
I guess I'm confused about what is in there and why?