dmd verus ldmd2 -lib option
Dan Olson
zans.is.for.cans at yahoo.com
Sat Feb 1 15:51:05 PST 2014
I noticed that dmd -lib breaks up a module into separate .o's when
building a static library. This is could help make smaller executables
(I am thinking smart phones) when linking with phobos because it will
only pull in to .o's needed to satisfy what is referenced.
ldmd2 -lib doesn't split into multiple .o's like dmd. Does it seem like
a good idea to do the same (I am thinking so).
Example: file testlib.d gets split into four .o's
cat >testlib.d <<eof
void foo() {}
void bar() {}
void xyzzy() {}
eof
$ dmd -lib -oflibtest.a testlib.d
$ nm libtest.a
libtest.a(testlib.o):
0000000000000050 D _D7testlib12__ModuleInfoZ
0000000000000030 T _D7testlib15__unittest_failFiZv
0000000000000000 T _D7testlib7__arrayZ
0000000000000018 T _D7testlib8__assertFiZv
U __d_array_bounds
U __d_assertm
U __d_unittestm
libtest.a(testlib_1_144.o):
0000000000000000 S _D7testlib3fooFZv
libtest.a(testlib_2_135.o):
0000000000000000 S _D7testlib3barFZv
libtest.a(testlib_3_25e.o):
0000000000000000 S _D7testlib5xyzzyFZv
More information about the digitalmars-d-ldc
mailing list