Lib change leads to larger executables
Walter Bright
newshound at digitalmars.com
Fri Feb 23 13:54:33 PST 2007
John Reimer wrote:
> optlink may just be the bane for D acceptance. And Tango gets the pitiful
> opportunity of demonstrating why D is NOT ready for prime-time in the
> commercial realm: the DM support tools it relies on are bogged down in
> the past, reflecting D's lopsided existance on yet another level: a strong
> language relying on a fragile, outdated, and poorly fit tool set.
Linux's ld exhibits the same behavior. Try compiling the 3 files here
according to the instructions below, and try different orderings adding
the object files to the librarian (ar). The same behavior as lib/optlink
results (using nm to see what symbols are placed into the resulting
executable).
------------------- test.d --------------------
import b; // a is not imported
void foo(...) { }
void test(char[][] s)
{
bbb2();
foo(s);
}
void main()
{
}
--------------------- a.d -------------------
void xxx(...) { }
void aaa(char[][] s)
{
xxx(s);
}
void aaa2() // never referenced nor imported 'bloat'
{
}
-------------------- b.d ---------------------
void yyy(...) { }
void bbb(char[][] s)
{
yyy(s);
}
void bbb2()
{
}
-------------------- build 1 -------------------
dmd -c a.d test.d
dmd -c b.d
rm foo.a
ar -r foo.a a.o b.o <= a comes before b
dmd test.o foo.a
nm test >log <= aaa2() appears in executable
-------------------- build 2 -------------------
dmd -c a.d test.d
dmd -c b.d
rm foo.a
ar -r foo.a b.o a.o <= b comes before a
dmd test.o foo.a
nm test >log <= aaa2() does not appear in executable
---------------------------------------------
More information about the Digitalmars-d
mailing list