Remove CRT (C's runtime) from betterC binaries?

Rel relmail at rambler.ru
Tue Aug 14 13:37:32 UTC 2018


On Tuesday, 14 August 2018 at 13:11:57 UTC, Rel wrote:
> Can I or is it even possible to remove the CRT (C's runtime 
> library) completely from my executables compiled with betterC 
> flag?

Okey, it seems I figure out how to do it with MinGW linker:

     import core.stdc.stdlib;
     import core.stdc.stdio;

     extern (C) void start() {
         printf("Hello World!");
         exit(0);
     }

     // dmd -c -m32mscoff -betterC -of=test32.obj test.d
     // dmd -c -m64 -betterC -of=test64.obj test.d
     // gcc -o test32.exe -m32 -nostdlib -s test32.obj -lmsvcrt
     // gcc -o test64.exe -m64 -nostdlib -s test64.obj -lmsvcrt


More information about the Digitalmars-d mailing list