Article View: comp.sys.mac.programmer.codewarrior
Article #531Re: Which of two functions gets linked?
From: Mark Taylor
Date: Tue, 13 Jul 2004 19:43
Date: Tue, 13 Jul 2004 19:43
29 lines
1984 bytes
1984 bytes
In article <mwron-4EF244.14421113072004@news.newsguy.com>, MW Ron <mwron@metrowerks.com> wrote: > In article <user02.20.mdt-0ED944.16165012072004@corp.supernews.com>, > Mark Taylor <user02.20.mdt@spamgourmet.com> wrote: > > >Hi all, > > > >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 source file should ALWAYS be used before the library even if the > link order is different are you seeing something other than that? > > Ron No, in fact the library function was being used and the linker was dead stripping the function in the .c file. The desired behavior is for the .c function to override the library version. I took Adriaan's advice and I checked the link order list. It turned out that the .c file was the last item in the list since it was recently added to the project. Moving it ahead of the libraries fixed the problem. (Thanks, Adriaan!) Upon reading your message I take it that it should not work this way? - Mark
Technical Details
Message-ID:
<user02.20.mdt-D089B9.14432713072004@corp.supernews.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!user02.20.mdtReferences:
<user02.20.mdt-0ED944.16165012072004@corp.supernews.com> <mwron-4EF244.14421113072004@news.newsguy.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!news1.google.com!sn-xit-02!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!user02.20.mdt From: Mark Taylor <user02.20.mdt@spamgourmet.com> Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac Subject: Re: Which of two functions gets linked? Date: Tue, 13 Jul 2004 14:43:27 -0500 Organization: (none) Message-ID: <user02.20.mdt-D089B9.14432713072004@corp.supernews.com> References: <user02.20.mdt-0ED944.16165012072004@corp.supernews.com> <mwron-4EF244.14421113072004@news.newsguy.com> User-Agent: MT-NewsWatcher/3.4 (PPC Mac OS X) X-Complaints-To: abuse@supernews.com Lines: 29