Article View: comp.sys.mac.programmer.codewarrior
Article #535Re: Which of two functions gets linked?
From: MW Ron
Date: Wed, 14 Jul 2004 16:12
Date: Wed, 14 Jul 2004 16:12
39 lines
2554 bytes
2554 bytes
In article <user02.20.mdt-0ED944.16165012072004@corp.supernews.com>,
Mark Taylor <user02.20.mdt@spamgourmet.com> wrote:
>When an identical function is defined in a .lib file and in a .c file,
>is there a way to control which one is linked in by the PowerPC Mach-O
>linker? It seems to be random and uncontrollable, but perhaps I am
>missing something?
The linker builds 3 list of files:
files ending in ".o" (if 'Enforce link order for ".o" files' is off)
files which the IDE associates with a text file (sources)
all other files (dylibs, and libs)
The ".o" case only exists in Mach-O but the rest of the code is the same
for both PEF and our Mach-O linker. This ".o" handling is important
since crt1.o needs to be treated as if it was first, and our users were
not very careful about doing this so we by default put all ".o" files
first, if the user enables Enforce link order for ".o" files then they
have to make sure that crt1.o appears in the correct link order.
The 3 lists are merge together into a single list in the order of the
list above. The linker then walks that list in that order, the only
special case is dylibs appear in order but are not actually processed
until the frameworks are scanned.
If you know of any other situation then we would like a bug report on
this.
Ron
--
Metrowerks Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and Metrowerks' staff
-- http://www.metrowerks.com/community --
Ron Liechty - MWRon@metrowerks.com - http://www.metrowerks.com
Technical Details
Message-ID:
<mwron-D8FDDC.12125114072004@news.newsguy.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!pln-e!spln!dex!extra.newsguy.com!newsp.newsguy.com!mwronReferences:
<user02.20.mdt-0ED944.16165012072004@corp.supernews.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f635e,43a4bcab7f7311b8
X-Google-Thread: 10bcce,43a4bcab7f7311b8
X-Google-Attributes: gidf635e,gid10bcce,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!pln-e!spln!dex!extra.newsguy.com!newsp.newsguy.com!mwron
From: MW Ron <mwron@metrowerks.com>
Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac
Subject: Re: Which of two functions gets linked?
Date: Wed, 14 Jul 2004 12:12:51 -0400
Organization: Metrowerks
Lines: 39
Message-ID: <mwron-D8FDDC.12125114072004@news.newsguy.com>
References: <user02.20.mdt-0ED944.16165012072004@corp.supernews.com>
NNTP-Posting-Host: p-566.newsdawg.com
User-Agent: MT-NewsWatcher/3.3b1 (PPC Mac OS X)
X-Face: )mY~XFHLw)UOW!W#[Ljvxq6Ja7(g'#F0-g*&puNxR8hEJkd@Oue/70^.)I78\
(%a%&Id211u"l/t.llWo/M|?15XUlx9!IGkdWiEmcasiyg"k;Q9[~XuE+`t2"*n(>nmm
@L/q,TjMd5+H{gASEPDR^$