MSC Danger (was Re: Turbo C vs Quick C)

terry terry at wsccs.UUCP
Sat Mar 12 18:50:17 AEST 1988


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.

	Because there is no way to set up a function such that if you call
it 'NEAR' at such-and-such an address, you can still call it 'FAR' at a prior
address.  The push's end up in the wrong order for near and far calls.  There
was a very good column on this in 'The Devil's advocate', a column carried by
several magazines, I think, and written by Stan Kelly Bootle (sp?).  I think
that fact that his Porshe liscence plate is 'MC68000' has nothing to do with
this dim view.

	Of course, the linker COULD do this, IF it were to generate code, but
linkers are not supposed to have to do that (if you can call what MSC uses
a linker :-( ).  Barring generation of appropriate code by the linker, which
would have to include translation of some previous code generated by the
compiler, such as _calls_ ;-), external refs, and so forth, as well as segment
crossing code requiring different instructions in large model, you can't do
it.  Even if you did, you 'small model' code would be using JMP's and so forth
with 16 bit addressing, rather than the 8 normally needed in small model.

	You should get a 'error: mixed code models' anyway, if you are using
a *real* compiler and linker...

				terry at wsccs



More information about the Comp.lang.c mailing list