On Jul 23, 2012, at 11:39 AM, maarten van damme wrote: > 2012/7/23 Sean Kelly <s...@invisibleduck.org>: >> On Jul 23, 2012, at 3:53 AM, maarten van damme wrote: >> >>> Got some more information here : http://wiki.osdev.org/D_Bare_Bones >>> >>> Any way to do this with dmd? When compiling with -debuglib=none and >>> -defaultlib=none I still get a 31 kb executable so druntime still gets >>> linked in. >> >> That's not druntime. The smallest an executable has ever been with runtime >> is ~60 kb, and it's larger than that now. > > doesn't druntime get linked in automatically when compiling any D > file? But your right, when I compile a normal empty d file with only a > main method the resulting executable is way bigger.
DMD automatically links in libphobos (which contains druntime), but the -defaultlib and -debuglib flags override that. For example, the druntime unit tests use -defaultlib=druntime -debuglib=druntime to explicitly link in druntime and thus avoid getting phobos as well.