17.01.2015 Views

Relocatable Object Module Format (OMF) Specification

Relocatable Object Module Format (OMF) Specification

Relocatable Object Module Format (OMF) Specification

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Relocatable</strong> <strong>Object</strong> <strong>Module</strong> <strong>Format</strong><br />

88H WKEXT—Weak Extern Record (Comment Class A8)<br />

Description<br />

This record marks a set of external names as "weak," and for every weak extern, the record associates another<br />

external name to use as the default resolution.<br />

History<br />

This comment class and subtype is a Microsoft extension added for Microsoft Basic version 7.0. There is no<br />

construct in Microsoft Basic that produces it, but the record type is manually inserted into Microsoft Basic library<br />

modules.<br />

The first user-accessible construct to produce a weak extern was added for Microsoft MASM version 6.0.<br />

See the following "Notes" section for details on how and why this record is used in Microsoft’s Basic and MASM.<br />

Record <strong>Format</strong><br />

The subrecord format is:<br />

1 1 or 2 1 or 2<br />

A8 Weak EXTDEF Default Resolution<br />

Index<br />

EXTDEF Index<br />

<br />

The Weak EXTDEF Index field is the 1- or 2-byte index to the EXTDEF of the extern that is weak.<br />

The Default Resolution EXTDEF Index field is the 1- or 2-byte index to the EXTDEF of the extern that will be used<br />

to resolve the extern if no "stronger" link is found to resolve it.<br />

Notes<br />

There are two ways to cancel the "weakness" of a weak extern; both result in the extern becoming a<br />

"strong" extern (the same as an EXTDEF). They are:<br />

• If a PUBDEF for the weak extern is linked in<br />

• If an EXTDEF for the weak extern is found in another module (including libraries)<br />

If a weak extern becomes strong, then it must be resolved with a matching PUBDEF, just like a regular<br />

EXTDEF. If a weak extern has not become strong by the end of the linking process, then the default<br />

resolution is used.<br />

If two weak externs for the same symbol in different modules have differing default resolutions, many<br />

linkers will emit a warning.<br />

Weak externs do not query libraries for resolution; if an extern is still weak when libraries are searched,<br />

it stays weak and gets the default resolution. However, if a library module is linked in for other reasons<br />

(say, to resolve strong externs) and there are EXTDEFs for symbols that were weak, the symbols<br />

become strong.<br />

Tool Interface Standards (TIS) <strong>OMF</strong> <strong>Specification</strong>, Version 1.1 23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!