D.gnu - libraries on windows
- Kagamin (15/15) Apr 19 2011 ---
- Iain Buclaw (8/23) Apr 19 2011 I was about to test until I noticed that compiling the test2 file took a
- Kagamin (3/6) Apr 19 2011 Haha, just by making sure they're always linked? :)
- Iain Buclaw (3/9) Apr 20 2011 link a symbol twice, it will complain about duplicate symbols.
--- 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
Apr 19 2011
== Quote from Kagamin (spam 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 onLinux?I use ar -cru test2.a test2.o gdc -v2 test.d test2.a -o test.exe -s -OsI 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).
Apr 19 2011
Iain Buclaw Wrote: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.Haha, just by making sure they're always linked? :) What is this strategy? I mean, wouldn't linker do it for you? I doubt it can link a symbol twice, it will complain about duplicate symbols.
Apr 19 2011
== Quote from Kagamin (spam here.lot)'s articleIain Buclaw Wrote:link a symbol twice, it will complain about duplicate symbols. GDC marks decls as one-only, which for linux, puts symbols in a .gnu.linkonce section.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.Haha, just by making sure they're always linked? :) What is this strategy? I mean, wouldn't linker do it for you? I doubt it can
Apr 20 2011