libraries on windows

Iain Buclaw ibuclaw at ubuntu.com
Tue Apr 19 15:07:37 PDT 2011


== Quote from Kagamin (spam at here.lot)'s article
> ---
> struct BL{int OAT=42;}
> BL[1024][64][4] bloat;
> void foo()
> {
> 	bloat[0][0][0].OAT=1;
> }
> void goo(){}
> ---
> I compile this file and archive it to a library and then link to another file.
> If goo is used, bloat also gets into executable, which is not true for dmd.
> Is this expected behavior or do I miss some options? Does gdc work the same on
Linux?
> I use
> ar -cru test2.a test2.o
> gdc -v2 test.d test2.a -o test.exe -s -Os

I was about to test until I noticed that compiling the test2 file took a
noticeably longer time to generate - so I corrected that speed demon by half first. =)

Anyway, yes I believe this would be the expected behaviour. GDC has a slightly
different strategy than DMD to ensure symbols that are supposed to be only linked
once are done so correctly.

If size matters, usually you'd strip all executables too (as well as using -Os).


More information about the D.gnu mailing list