public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: LINKING ORDER
@ 2002-10-03  1:40 Bjorn R. Jensen
  0 siblings, 0 replies; 3+ messages in thread
From: Bjorn R. Jensen @ 2002-10-03  1:40 UTC (permalink / raw)
  To: Naveen Malik, gcc-help

Hi Naveen,

 The linker goes through the object files in the specified order
looking for unresolved symbols, all other symbols are ignored, even
if the symbols are needed later. This applies to symbols defined in
libraries as well.
 If this was not done, the linker would have to keep track of huge
numbers of symbols most likely not needed at all....

Yours sincerely,

Bjorn

On Thu, 03 Oct 2002 03:31:16 +0000, "Naveen Malik"
<maliknaveen@hotmail.com> said:
> Hi Everybody,
> 
> I have to compile and link 5 C files.
> 
> Let us assume that the five files are A, B, C, D and E.
> 
> Now the problem is does it really matters as how I give their linking
> order 
> say A to E or E to A or any other combination. And if yes, then how?
> 
> Please guide me.
> 
> Regards
> 
> Naveen Malik
> 
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LINKING ORDER
  2002-10-02 20:31 Naveen Malik
@ 2002-10-03 13:07 ` Eljay Love-Jensen
  0 siblings, 0 replies; 3+ messages in thread
From: Eljay Love-Jensen @ 2002-10-03 13:07 UTC (permalink / raw)
  To: Naveen Malik, gcc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* LINKING ORDER
@ 2002-10-02 20:31 Naveen Malik
  2002-10-03 13:07 ` Eljay Love-Jensen
  0 siblings, 1 reply; 3+ messages in thread
From: Naveen Malik @ 2002-10-02 20:31 UTC (permalink / raw)
  To: gcc-help

Hi Everybody,

I have to compile and link 5 C files.

Let us assume that the five files are A, B, C, D and E.

Now the problem is does it really matters as how I give their linking order 
say A to E or E to A or any other combination. And if yes, then how?

Please guide me.

Regards

Naveen Malik

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-03 20:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-03  1:40 LINKING ORDER Bjorn R. Jensen
  -- strict thread matches above, loose matches on Subject: below --
2002-10-02 20:31 Naveen Malik
2002-10-03 13:07 ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).