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

Ecstatic Coder ecstatic.coder at
Mon Sep 30 03:36:53 UTC 2019

On Sunday, 29 September 2019 at 23:14:10 UTC, Boris Carvajal 
> On Sunday, 29 September 2019 at 11:15:43 UTC, Ecstatic Coder 
> wrote:
>> 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() 
> function).
> Also, make sure to NOT USE optlink linker by using -m32mscoff 
> -m64 respectively.
> Example:
> dmd test.d -m64 -L/Brepro      // or -L/timestamp:0

Exactly the compiler option I was looking for :)

Thanks a lot to you, and also to the other nice members of the D 
community who have taken the time to answer my question. Much 

More information about the Digitalmars-d mailing list