🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2241

Re: "extern" and function declarations

#2241
From: David Thomas Richard Given
Date: Tue, 12 Mar 1996 01:26
30 lines
1681 bytes
In article <4hmslm$b3l@solutions.solon.com>,
Guillaume Laurent  <glaurent@worldnet.net> wrote:
(snip)
>In article <4hdqjq$8pr@solutions.solon.com> fred@genesis.demon.co.uk (Lawrence Kirby) writes:
>I've got a question here : what if the same above declaration is made
>in two (or more) files, compiled seperately then linked together ?
(snip)

I've done this many times (by accident). The linker gives you a `object 
is multiply defined' error and it won't link.

(snip)
>>From what I've tried, the final effective value of i depends on the
>order of linking of the objects :
>
>cc a.o b.o -o foo  ---> i=1
>cc b.o a.o -o foo  ---> i=2

Good grief. What linker are you using? It should *not* be doing this...

>But I'm still wondering about the "duplicate" space...

Well, it isn't duplicated until it's finally linked together. And a 
(decent) linker shouldn't let you do this.

-- 
-------------------------------------------------------------------------------
   Why do people surf the Information Superhighway? Won't they get run over?
               http://www-hons-cs.cs.st-andrews.ac.uk/~dg
              Sun-Earther David Daton Given  of Lochcarron
Technical Details
Message-ID: <4i2jrg$8e7@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4hdqjq$8pr@solutions.solon.com> <4hmslm$b3l@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: dtrg@st-andrews.ac.uk (David Thomas Richard Given)
Newsgroups: comp.lang.c.moderated
Subject: Re: "extern" and function declarations
Date: 11 Mar 1996 19:26:08 -0600
Organization: University Of St. Andrews, Fife, UK.
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4i2jrg$8e7@solutions.solon.com>
References: <4hdqjq$8pr@solutions.solon.com> <4hmslm$b3l@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com