Linking large D programms

"Jérôme M. Berger" jeberger at free.fr
Sat May 1 11:15:05 PDT 2010


Torsten Sommerfeld wrote:
> Hello,
> 
> I have a problem creating executables from more than 100 d modules (under
> linux). DMD compiles even 300 files in seconds but the linking step takes
> several minutes. It is clear that the linker has do handle an enormous amount
> of symbols so it needs the time.
> However it is hardly acceptable on the long run.
> 
> Are there some alternative linkers to replace ld? Is there an incremental
> linker which can be used?
> 
> If I cannot find a solution for this problem I fear I have to convert my
> project to Java (my D code looks almost like Java code) wher this "limitation"
> is not there.
> I do not like Java much and converting is a painful lot of work but as it is I
> cannot continue with D.
> 
> Does anyone have any ideas?
> 
	You might want to look at the "-r" option for ld. I allows to do
partial linking by combining several object files into an object
file, resolving everything that it can resolve. So if you have:

package1/module1
        /module2
package2/module1
        /module2

	You can do:
ld -o package1.o -r package1/module1.o package1/module2.o
ld -o package2.o -r package2/module1.o package2/module2.o
ld -o program package1.o package2.o

	Of course, the first time you do it, it will still be long, but if
you only modify something in package2, then you won't need to relink
package1 so it should speed up the development cycle.

		Jerome
-- 
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100501/e98a94d3/attachment.pgp>


More information about the Digitalmars-d mailing list