#pragma export

Category

Object code control

Purpose

Declares that an external function or variable is to be exported.

The pragma also specifies the name of the function or variable to be referenced outside the module. You can use this pragma to export functions or variables from a DLL module.

Syntax

#pragma export

Read syntax diagramSkip visual syntax diagram#pragmaexport (identifier)

Defaults

Not applicable.

Parameters

identifier
The name of a variable or function to be exported.

Usage

You can specify this pragma anywhere in the DLL source code, on its own line, or with other pragmas. You can also specify it before or after the definition of the variable or function. You must externally define the exported function or variable.

If the specification for a const variable in a #pragma export directive conflicts with the ROCONST option, the pragma directive takes precedence over the compiler option, and the compiler issues an informational message. The const variable gets exported and it is considered reentrant.

The main function can not be exported.

IPA effects

If you specify this pragma in your source code in the IPA compile step, you cannot override the effects of this pragma on the IPA link step.