Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rlgvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!bellcore!decvax!genrad!panda!talcott!harvard!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.unix-wizards Subject: Re: 4.2::SYSV compatability problem Message-ID: <402@rlgvax.UUCP> Date: Tue, 29-Jan-85 13:29:10 EST Article-I.D.: rlgvax.402 Posted: Tue Jan 29 13:29:10 1985 Date-Received: Sat, 2-Feb-85 13:26:48 EST References: <7797@brl-tgr.ARPA> Organization: CCI Office Systems Group, Reston, VA Lines: 29 Ah yes, the old "multiple extern" problem. The C language reference says that only one definition of an external variable (i.e. something without "extern" in front of it) is allowed; all other declarations must be references using "extern". This is because the UNIX linker is one of the few linkers (the only one?) which uses the FORTRAN common-block model for external declarations, where if the symbol is defined several times it takes the biggest of the declarations and uses that. Most other linkers choke if given more than one declaration. In practice, since the UNIX linker doesn't choke on multiple declarations (prior to System V), UNIX code was written to assume it was OK to declare something more than once. The System V linker was changed to choke on this - I guess to "enforce" the same restriction that other linkers have, in order to detect code that couldn't be moved to other OSes. The System V Release 2 linker, on the VAX at least, changed this back (in response to a chorus of howls from users, I suspect) but provided an option to support the old S5R1 behavior. I suspect AT&T may not have put the latest linker into your 3B; complain to them (or change your code; once that's done, it makes it more likely that the code will work on other systems which don't use the common-block model for externals). And no, Berkeley didn't fix anything. Bell, arguably, broke something in S5R1; given that they changed it back in S5R2, they may agree. (Lots of things that you might think are "Berkeley vs. S5" or "Berkeley vs. Bell" aren't.) Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy