LINKING ORDER

Eljay Love-Jensen eljay@adobe.com
Thu Oct 3 13:07:00 GMT 2002


If A uses stuff in B, then A must appear before B.

If B uses stuff in C, then B must appear before C.

If D and E use stuff in A, B and C, then D and E must appear before A, B and C.

If D uses stuff in E, and E uses stuff in D, then D must appear before E, 
and E must appear before D.  (I assume you now have a confused expression.)

Given all the above,
g++ D.o E.o D.o A.o B.o C.o

Notice that D.o appears twice, to satisfy the D-E co-dependency.  Generally 
considered Bad Form, and a Bad Thing.  Comment that co-dependency in the 
make file, lest the poor maintenance programmer (aka "code janitor") make a 
faux edit.

Voila.

--Eljay



More information about the Gcc-help mailing list