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!mit-eddie!godot!harvard!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.lang.c Subject: Re: Multiple external definitions Message-ID: <568@rlgvax.UUCP> Date: Mon, 11-Mar-85 19:22:12 EST Article-I.D.: rlgvax.568 Posted: Mon Mar 11 19:22:12 1985 Date-Received: Wed, 13-Mar-85 01:00:20 EST References: <151@cci-bdc.UUCP> <282@cmu-cs-k.ARPA> <363@sftri.UUCP> <5124@utzoo.UUCP> <365@sftri.UUCP> <551@rlgvax.UUCP> <634@ncoast.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 23 > > All UNIXes prior to System V supported multiple external definitions. > > Our Xenix system, however, doesn't, for all that it was developed from V7 > source. Lots of programs fail spectacularly on my terminal (including the > editor I'm using to type this in), because my terminal requires padding > and almost every termcap-using program we get has "int ospeed;" in it > (we need "extern short ospeed;", also outlining a certain size dependency... If your program links without complaint, then your Xenix supports multiple external definitions. If it only fails on your terminal, it must have linked without complaint in order to run on another terminal. The problem you're describing is a separate problem; externals in UNIX behave like FORTRAN common blocks, in that externals have a size, and if you have several declarations of the same external with different sizes, the biggest one wins. If your machine has 32-bit "int"s, and it's big-endian (like a 68000 with 32-bit "int"s), then one declaration as a "short" and one declaration as an "int" won't work (references to the "short" will pick up the *upper* 16 bits of the "short", which will be zero, and thus give no padding). (If your machine is little-endian, it's *still* wrong, but symptomless in this particular case.) -- Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy