EXPORTS Module Definition Statement

Syntax: Parameters:

EXPORTS
    
[enm=] inm [@ord[keywrd]] [parms]

EXPORTS
enm [=inm] [@ord[keywrd]] [pwrds]

  • Entry name
  • Internal name for function
  • Ordinal position of function
  • DECORATED|CONSTANT
  • Size of function's parameters

Use the EXPORT statement when you are creating a dynamic link library to define the names and attributes of data and functions exported from the DLL, and of functions that run with I/O hardware privilege.

Give export definitions for functions and data in your DLL that you want to make available to other .EXE or .DLL files. Data and functions that are not exported can only be accessed within your DLL, and cannot be accessed by other .EXE or .DLL files.

The EXPORTS keyword marks the beginning of the export definitions. Enter each definition on a separate line. You can provide the following information for each export:

 
enm
The entry name of the data construct or function, which is the name other files use to access it. Always provide an entry name for each export. It is strongly recommended that you decorate each entry name, to ensure that the correct function is linked in.
inm
The internal name of the data construct or function, which is its actual name as it appears within the DLL. If specified, the internal name must be decorated. If you do not specify an internal name, the linker assumes it is the same as enm.
ord
The data construct or function's ordinal position in the module definition table. If you provide the ordinal position, the data construct or function can be referenced either by its entry name or by the ordinal. It is faster to access by ordinal positions, and may save space.
keywrd
You can specify one of the following two values. DECORATED is the default.
 
DECORATED
The name should be left as-is. No decoration is applied to the function name.
CONSTANT
Indicates that the export entity is a variable, not a function.

You cannot specify both values.

keywrd
RESIDENTNAME
Indicates that you want the data construct or function's name kept resident in memory at all times. You only need to specify RESIDENTNAME if you gave an ordinal position in ord. When a data construct or function does not have an ordinal position defined, OS/2 keeps the name of the exported data construct or function resident in memory by default.
NONAME
Indicates that you want the data construct or function to always be referenced by its ordinal number. If you specify NONAME, the data construct or function cannot be referenced by name: it can only be referenced by ordinal number.

You cannot specify both values.
parms
The total size of the function's parameters, as measured in words (bytes divided by two). This field is required only if the function executes with I/O privilege. When a function with I/O privilege is called, Windows consults parms to determine how many words to copy from the caller's stack to the stack of the I/O-privileged function.
pwrds
The total size of the function's parameters, as measured in words
(bytes divided by two). This field is required only if the function executes with I/O privilege. When a function with I/O privilege is called , OS/2 consults pwrds to determine how many words to copy from the caller's stack to the stack of the I/O-privileged function.

Example Export Statement

The following example defines three exported functions:

EXPORTS
  ?SampleRead = ?read2bin @8
  ?StringIn = ?str1       @4
  ?CharTest  6

The first two functions can be accessed either by their exported names or by an ordinal number. Note that in the module's own source code, these functions are actually defined as read2bin and str1, respectively. The last function runs with I/O privilege, and so has parms (the total size of the parameters) defined for it as six words.



Summary of Module Definition Statements