July 23, 2012
2012/7/23 Sean Kelly <sean@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.

When I compile with -defaultlib=none and -debuglib=none it now complains about none.lib not beeing found. How can I link in an empty .lib?

I did another check to see if druntime was getting linked in by creating an instantiating a class. It now complains about __d_newclass not beeing found so druntime really isn't getting linked.
July 23, 2012
On Monday, 23 July 2012 at 12:08:31 UTC, maarten van damme wrote:
> I couldn't find anything D-related in the map file. When I compile
> without -debuglib=none and -defaultlib=none I also get a 31 kb
> executable with the exact same map file. Does he ignore those flags?

Your linker probably automatically includes the C runtime.

David
July 24, 2012
On Jul 23, 2012, at 11:39 AM, maarten van damme wrote:

> 2012/7/23 Sean Kelly <sean@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.

1 2
Next ›   Last »