Required to link windows header modules (?)

Walter Bright newshound at digitalmars.com
Fri Jun 9 01:09:54 PDT 2006


Sean Kelly wrote:
> Linking with the windows module present in Phobos isn't a big deal.  But 
> the Windows header project Don has been working on is quite expansive, 
> and simply importing windows.d ends up pulling in a substantial chunk of 
> the windows modules.  This slows compilation noticeably and increases 
> binary size significantly--simply importing Don's windows.d in my test 
> app made the executable size increase from ~90K to over 150K.  This 
> appears to be related at least in part to what appears to be a fixed 
> minimum for importing a module using DMD of approximately 500 bytes, 
> which I assume is the ModuleInfo data and similar things.

It's pretty easy to see what's in a .obj file by running obj2asm on it.

> What I find confusing, however, is that I don't appear to need to link 
> in the standard C modules I've defined in order to use the structs 
> defined there.  I performed a quick test using struct tm and no 
> dependency problems came up simply by compiling the test app itself and 
> linking against a library without std.c.time in it.  Assuming I didn't 
> mess up the test somehow, can you explain the difference between this 
> situation and the Windows one?  If it's simply a matter of having the 
> static initializers available, I'm fine with building everything, but 
> the inconsistency doesn't seem to make sense.

You shouldn't need to link in the static initializer for a struct if the 
static initializer is all 0's.



More information about the Digitalmars-d-bugs mailing list