MSC Danger (was Re: Turbo C vs Quick C)
John Unekis
jru at etn-rad.UUCP
Wed Mar 16 06:24:13 AEST 1988
In article <304 at wsccs.UUCP> terry at wsccs.UUCP (terry) writes:
>In article <1082 at dutesta.UUCP>, knop at 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
=========================================================================
More information about the Comp.lang.c
mailing list