DIFFERENT METHODS FOR SPECIFYING LINKS

The module definition files for STRPROG and STRLIB show only one of several possible methods for listing functions to be exported from one module and imported in another. STRLIB's EXPORTS section looks like this:

EXPORTS AddString

DeleteString

GetStrings

STRPROG's IMPORTS section refers to both the library module and the function names:

IMPORTS STRLIB.AddString

STRLIB.DeleteString

STRLIB.GetStrings

Here's another method: The module definition file for STRLIB can assign ”ordinals“ to each of the functions. These are simply unique positive integers preceded by @:

EXPORTS AddString @1

DeleteString @2

GetStrings @3

STRPROG's IMPORTS section then references these numbers:

IMPORTS AddString = STRLIB.1

DeleteString = STRLIB.2

GetStrings = STRLIB.3

This method gives STRPROG a smaller .EXE file, because the file simply stores the ordinal numbers rather than the names of all the functions. For a large number of imported functions, this method provides a significant reduction in .EXE size. It's a little trickier to use than the first method, because you have to be sure you get the numbers right.

You can also use function names in the program that are different from those in the library. For instance, suppose that in STRPROG you use the names AddStr, DelStr, and GetStr instead of AddString, DeleteString, and GetStrings. You can reference these aliases to the real function names in the IMPORTS section:

IMPORTS AddStr = STRLIB.AddString

DelStr = STRLIB.DeleteString

GetStr = STRLIB.GetStrings

Or if the module definition file for STRLIB defines ordinals for each of the functions, the IMPORTS section will look like this:

IMPORTS AddStr = STRLIB.1

DelStr = STRLIB.2

GetStr = STRLIB.3

Even if you don't explicitly specify ordinal numbers for the exported functions in the library module definition file, LINK assigns ordinal numbers to the functions. You can determine these ordinal numbers by running EXEHDR on the library module.