export Link Option

Syntax: Default:
link(export, external_name
, [internal_name] )
link(export, external_name
, [internal_name]
, [ordinal]
, [RESIDENTNAME | NONAME]
, [PARMWORDS | CONSTANT]
, [numWords] )
none

This option makes an internal symbol visible outside the module being built. You can use it to export symbols from a DLL or shared library.

For modules built from C++ source code, the options link(exportAll), link(export_NameSpace, name), and link(export_Prefix, prefix) are easier to use than link(export, ...) or link(exportList, fileName.), but give you less flexibility.

You can specify just the name of the symbol with this option. Optionally, you can specify some or all the parameters described in the table below. The only way to apply the optional parameters to exported symbols is to use this option or link(exportList, fileName).

The parameters shown enclosed in [ and ] are optional. When you omit them, insert a comma as a place holder if you specify any later parameters. The | character separates alternatives.

For example, the line below exports the symbol ABC. The second parameter is omitted, so the internal name of the symbol must also be ABC. The third parameter puts ABC in position 5 in the module definition table, giving it ordinal value 5. The parameter after NONAME is also omitted, but a place-holding comma is not required because no other parameters follow. The effect of NONAME depends on the operating system as explained in the table below.

link(export, "ABC",, 5,NONAME)

This table describes the parameters of this option in detail.

parameter meaning
external_name This string is the name by which the symbol is known to other modules.
internal_name This string is the actual name of the function or data item as it appears within the DLL or shared library. By default this is the same as the external name.
If the name is defined in a C++ module and is not declared with extern "C" linkage, this must be the mangled name.
On Windows, the name must be in decorated form.
ordinal This number specifies the function's ordinal position within the module definition table. The value of ordinal must be in the range 1 to 65,535. If you supply an ordinal number, the symbol can be referred to when it is imported by either its external name or its ordinal value.
ordinal is ignored on AIX
RESIDENTNAME

or

NONAME

RESIDENTNAME tells OS/2 to keep the name of the symbol resident in memory at all times. You can specify this only if you also supply an ordinal. If you do not supply an ordinal, OS/2 keeps the name memory resident by default.
RESIDENTNAME is ignored on Windows NT.
RESIDENTNAME is ignored on AIX.

NONAME is ignored on OS/2.
NONAME removes the name of the function from the symbol table on Windows NT. You can specify this only if you also supply an ordinal, because the function can be located only by ordinal number.
NONAME is ignored on AIX.

PARMWORDS

or

CONSTANT

Use PARMWORDS only when you are including the sixth parmeter, described below.
PARMWORDS is ignored on Windows NT.
PARMWORDS is ignored on AIX.

CONSTANT is ignored on OS/2.
Use CONSTANT on Windows NT when the exported symbol is the name of a data item. Do this to avoid inappropriate symbol resolution when linking to a module that does not declare the data reference as an import.
CONSTANT is ignored on AIX.

numWords This number must be preceded by PARMWORDS. It specifies the number of 2-byte words required to store the function parameters on OS/2 and used only for symbols in sections with I/O Privilege. The number and PARMWORDS are ignored in sections that are not IOPL. You can specify IOPL with link(code,attributes) or link(section, name, attributes).
numWords is ignored on Windows NT.
numWords is ignored on AIX.


Incremental C++ Builds
C Compilation
Configuration Files
Decorated and Mangled Names


Set Build Options
Build
Build Dynamic Link Libraries
Export Symbols from a DLL
Get Mangled Names for C++ Symbols


Link Options
Link Options