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

H. S. Teoh hsteoh at
Sun Sep 29 12:30:46 UTC 2019

On Sun, Sep 29, 2019 at 11:15:43AM +0000, Ecstatic Coder via Digitalmars-d wrote:
> Every time I compile the same code with DMD, I get a slightly
> different ".exe" file on Windows.
> fc /b basil.exe basil_old_1.exe
> 00000118: 9F 55
> 00000119: 8C 89
> 00156554: 9F 55
> 00156555: 8C 89
> fc /b basil.exe basil_old_2.exe
> 00000118: 9F 1B
> 00000119: 8C 8A
> 00156554: 9F 1B
> 00156555: 8C 8A
> This problem is D specific, as for instance Go will generate the same
> executable each time.
> 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" ?

Seems this is Windows-specific; I can't reproduce this on my Linux box.
Which leads me to think this isn't a dmd problem; it may be the linker
that's inserting the timestamp. Which linker is being used? Perhaps an
approprate option passed to the linker is what you need. You can pass
options to the linker with -L... (on Windows it might be /L..., not 100%


Give a man a fish, and he eats once. Teach a man to fish, and he will sit forever.

More information about the Digitalmars-d mailing list