digitalmars.D.learn - How to prepare and generate a simple lightweight binary?
There are lots of talks on this forum about Statical linking, Dynamic linking. There are even shouts: "use the ldc compiler instead, it can do all that and even more than the default dmd compiler!!!" and bunch of compiler flags, no instructions on how to start or even steps on how to reproduce a simple program that wouldn't weight megabytes. I would like receive all the steps in this thread, with all the obvious download links and little commenting - the walkthrough. What I would expect: A simple executable program that does a writeln and do not weight tons of megabytes. Thanks. (1 ton of megabyte == 1 megabyte == 1MB)
Jun 25 2019
On Tuesday, 25 June 2019 at 13:13:34 UTC, BoQsc wrote:What I would expect: A simple executable program that does a writeln and do not weight tons of megabytes. Thanks.void main() { import std.stdio; writeln("Hello world!"); } Ubuntu 18.04, LDC v1.16:ldc2 hello.d=> ~1.7 MBldc2 hello.d -link-defaultlib-shared=> < 20 KB The 2nd executable depends on the shared druntime and Phobos libraries though, whereas the first one is standalone.
Jun 25 2019