Introduction
Compilers and assemblers for 16-bit DOS and Windows kept their runtime libraries in
.lib files of this format: a collection of
OMF object modules, with a dictionary that lets a
linker find the module defining a name without reading them all.
Structure
0library header, a record of type 0xF0, padded to the page size1 page…modules, each an OMF object module starting on a page boundaryvaries…end record of type 0xF1, padded to a 512-byte boundaryvaries…dictionary blocks512 bytes each
The library header
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 1 | Type | 0xF0 |
| 1 | 2 | Record length | The bytes after this field; the page size minus 3. The page size is a power of two, usually 16 or 512. |
| 3 | 4 | Dictionary offset | The file offset of the dictionary |
| 7 | 2 | Dictionary size | The number of 512-byte blocks |
| 9 | 1 | Flags | Bit 0 set: the names are case-sensitive |
| 10 | to the page | Padding | Up to the page size |
Modules
Each module is an OMF object module, from THEADR or LHEADR to MODEND, and starts at a multiple of the page size. A module is named by its offset divided by the page size: its page number. Padding fills up to the next multiple of the page size. The dictionary uses these page numbers to find a symbol’s module.
The end record
After the last module comes a record of type 0xF1, with a length and a run of padding that brings the file to the next 512-byte boundary, where the dictionary starts.
Variants
- Windows COFF library – a Windows static or import library in the ar archive format
- Short import object – one member of an import library: a header and two strings
- OMF library – a library of OMF object modules from 16-bit compilers
Links
Software
- Open Watcom – compiler suite with the
wliblibrarian (Windows, Linux, DOS, OS/2)
Reference
- Object Module Format (Intel) – Wikipedia’s overview, with links to the Tool Interface Standards specification