Observe:
$ ls *.d
usage.d
$ dmd usage.d
$ ls usage*
usage usage.d usage.o
DMD has left over the intermediate .o file. So I try whether it will clean it up if I use -of, but no:
$ rm *.o
$ dmd -ofusage usage.d
$ ls usage*
usage usage.d usage.o
$
OK then I find that the DMD man page says:
-o- Suppress generation of object file
So I try that:
$ rm usage{,.o}
$ dmd -o- usage.d
$ ls usage*
usage.d
Wha'?! No output at all. Apparently using -o- actually causes DMD to suppress all binary output, which is not what is advertised. (Yeah OK one could argue that the executable is also an object file in some sense of the word, but AFAICS that is not what is generally understood by "object file".)
On the forum, it was said (http://forum.dlang.org/post/[email protected]) that the reason for the .o files is that the compiler and linker are two different programs, but IIUC even with GCC/Clang for C/C++, the same is true, and on long compile runs with GCC/Clang I have observed temporary .o files being created in my /tmp dir and disappearing after a short while.
Surely DMD knows what .o files it is creating for the linker so that it should not be a problem for it to clean them up after having done with them. Somehow DMD not cleaning up after itself seems very unprofessional and doesn't contribute to D's image especially to those migrating from C/C++.
Please make it so that DMD doesn't litter my directory with .o files when I haven't specifically requested that using -c. Thanks!
I'm using latest DMD 2.0.69.2 on Kubuntu Trusty 64 bit.
Comment #1 by robert.schadek — 2024-12-13T18:46:06Z