Xref: utzoo comp.lang.c:8217 comp.sys.ibm.pc:13254 Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!elroy!mahendo!jplgodo!wlbr!etn-rad!jru From: jru@etn-rad.UUCP (John Unekis) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: MSC Danger (was Re: Turbo C vs Quick C) Message-ID: <469@etn-rad.UUCP> Date: 15 Mar 88 20:24:13 GMT References: <389@lscvax.UUCP> <567@naucse.UUCP> <2946@dasys1.UUCP> <1082@dutesta.UUCP> <304@wsccs.UUCP> Reply-To: jru@etn-rad.UUCP (John Unekis) Organization: Eaton Inc. IMSD, Westlake Village, CA Lines: 26 Keywords: near far large small mixed In article <304@wsccs.UUCP> terry@wsccs.UUCP (terry) writes: >In article <1082@dutesta.UUCP>, knop@dutesta.UUCP (Peter Knoppers) writes: >> >> Why, oh why don't the .obj files in MSDOS contain some bits telling >> the linker whether a function in the .obj file expects to be called >> with a FAR or a NEAR call. This can prevent accidentally linking >> modules compiled for different models. ... The problem is not with the linker, but with the compiler. The code which performs a subroutine call is generated at compile time, and it either pushes the segment registers on the stack (FAR call) with the offset registers, or it simply pushes the offset registers alone (NEAR call). The problem with labelling entry points for the linker is that an entry point may be NEAR when placed in the same segment with the calling code by the linker, or FAR when it has to be placed in a separate segment due to code size. Therefore a lot of large model FAR subroutine calls are redundant because the code actually fits in one segment (but there are no guarantees). If all this gets too frustrating for words, you could always buy a computer with a real processor chip(like the 68000) that doesn't have 20 year old START-OF-THE-ART problems like segment boundaries. ========================================================================= My opinions are so good that my employer would like to own them, but they remain mine alone. {ihnp4 or voder}!wlbr!etn-rad!jru =========================================================================