How C compilers handle multiple function definitions.

RealCat <typingcat@gmail.com>
Sun, 28 Dec 2008 18:12:00 -0800 (PST)

          From comp.compilers

Related articles
How C compilers handle multiple function definitions. typingcat@gmail.com (RealCat) (2008-12-28)
Re: How C compilers handle multiple function definitions. armelasselin@hotmail.com (Armel) (2008-12-29)
Re: How C compilers handle multiple function definitions. mburrel@uwo.ca (Mike Burrell) (2008-12-29)
Re: How C compilers handle multiple function definitions. gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-12-30)
Re: How C compilers handle multiple function definitions. kamalpr@hp.com (kamal) (2009-01-01)
Re: How C compilers handle multiple function definitions. kamalpr@hp.com (kamal) (2009-01-01)
| List of all articles for this month |
From: RealCat <typingcat@gmail.com>
Newsgroups: comp.compilers
Date: Sun, 28 Dec 2008 18:12:00 -0800 (PST)
Organization: Compilers Central
Keywords: C, question, linker, comment
Posted-Date: 29 Dec 2008 08:25:04 EST

If there are functions whose names are the same in object files and
library files, what should happen during the compliation? Should this
always cause a link error, or can C compilers make assumptions such
as : "function definition in the object file has higher precedence
over the one in the library file" or "the one in the previously linked
library file has higher precedence over the ones in the library files
linked later."?


Is there any standard behaviour for this case or does it vary with
compiler implimentations?
[Usually linkers only pull in library routines that satisfy unresolved
references, so if there's a duplicate, the linker just ignores it. A
more interesting question is what happens when the program has a definition
of A and a reference to B, and a library module defines both A and B.
-John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.