[net.micro.pc] OBJ, EXE & LIB Formats

DEWAR.ACF2@NYU-CMCL1.ARPA (12/02/83)

From:  Robert Dewar <DEWAR.ACF2@NYU-CMCL1.ARPA>

Only the OBJ format is (more or less) compatible with the Intel
standard, and there are several discrepancies apparently resulting
from less than careful reading of the appropriate manual by Microsoft
(in particular, MS compilers generate zero type indexes, which are not
permitted by the Intel standards, and which are rejected by the Intel
linker). Be warned that the object format is ludicrously complex and
it is a major project to understand it fully!

The EXE format is fully documented in the DOS manual. The only glitch
I am aware of is that the text must start on a 512 byte boundary or it
will not be properly loaded by COMMAND.COM.

The LIB format consists basically of concatenated object modules,
which are forced to be on 512 byte boundaries (thus wasting huge
amounts of space), followed by some kind of hash table. I have been
totally unable to locate technical descriptions of this format, any
help would be appreciated. Why MS did not use the standard Intel
format for libraries I have no idea!

Another pretty much undocumented feature in the MS/DOS linker is the
overlay facility. This again does not follow the Intel standards. The
way to get overlays is simply to set a non-zero overlay index in the
segment record, the linker will then generate separate files for each
overlay (you have to write your own handler to load the overlays).
MS/COBOL uses this feature.

One more note on EXE format. The format specifies a special two byte
header and a checksum. Absolutely no-one checks either of these fields,
a fact made clear by the fact that the MS (IBM) PASCAL EXE files are
distributed with the first two bytes reversed!