How to prevent DMD from changing the executable files at each compilation ?

Boris Carvajal boris2.9 at
Sun Sep 29 23:14:10 UTC 2019

On Sunday, 29 September 2019 at 11:15:43 UTC, Ecstatic Coder 
> Every time I compile the same code with DMD, I get a slightly 
> different ".exe" file on Windows.
> So before I implement a tool for this, is there an easy way to 
> prevent DMD from "timestamping" its generated binaries, so that 
> they become more "git-friendly" ?

Using the mingw64 setup you have two options, from LLVM linker 
usage help:
(lld-link --help)

/Brepro               Use a hash of the executable as the PE 
header timestamp
/timestamp:<value>    Specify the PE header timestamp

The first emulates a Visual Studio linker undocumented option. If 
you change to the VS config this should work too.
The second uses a classic C/Unix timestamp value (time() 

Also, make sure to NOT USE optlink linker by using -m32mscoff 
-m64 respectively.


dmd test.d -m64 -L/Brepro      // or -L/timestamp:0

More information about the Digitalmars-d mailing list