/EXPORT

Syntax:

/EXPORT:entryname[=internalname][, @ordinal [, NONAME]] [, DATA]

Lets you export a function from your program to allow other programs to call the function. You can also export data. Exports are usually defined in a DLL.

The entryname is the name of the function or data item as it is to be used by the calling program. You can optionally specify the internalname as the function known in the defining program; by default, internalname is the same as entryname. The ordinal specifies an index into the exports table in the range 1 - 65535; if you do not specify ordinal, LINK assigns one. The NONAME keyword exports the function only as an ordinal, without an entryname.

The DATA keyword specifies that the exported item is a data item. The data item in the client program must be declared using DLLIMPORT. (The CONSTANT keyword is supported for compatibility but is not recommended.)

There are three methods for exporting a definition, listed in recommended order of use:

All three methods can be used in the same program. When LINK builds a program that contains exports, it also creates an import library, unless an .EXP file is used in the build.

LINK uses decorated forms of identifiers. A "decorated name" is an internal representation of a procedure name or variable name that contains information about where it is declared; for procedures, the information includes how it is called. Decorated names are mainly of interest in mixed-language programming, when calling Fortran routines from other languages.

The compiler decorates an identifier when it creates the object file. If entryname or internalname is specified to the linker in its undecorated form as it appears in the source code, LINK attempts to match the name. If it cannot find a unique match, LINK issues an error.

Use the DUMPBIN tool described in Examining Files with DUMPBIN to get the decorated form of an identifier when you need to specify it to the linker. Do not specify the decorated form of identifiers declared with the C or STDCALL attributes. For more information on when and how to use decorated names, see Adjusting Naming Conventions in Mixed-Language Programming.