On 2016-10-05 11:39, Martin Nowak wrote:

Because you're linking with druntime/phobos which drags in plenty of
symbols (including a GC). Also Jakob is showing the symbols of the
object file, not executable.

No. There's a difference between DMD 2.070.0 and 2.071.0:

$ cat main.d
module main;

extern (C) int printf(in char*, ...);

extern (C) void main()
{
    printf("asd\n");
}

$ dvm use 2.070.0
$ dmd --version
DMD64 D Compiler v2.070.0
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
$ dmd -betterC main.d
$ nm main | wc -l
       4
$ dvm use 2.071.0
$ dmd --version
DMD64 D Compiler v2.071.0
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
$ dmd -betterC main.d
$ nm main | wc -l
    2428

Note that "main" is declared as "extern (C)", which makes all the difference.

--
/Jacob Carlborg

Reply via email to