# ATTRIBUTES DLLEXPORT and DLLIMPORT

The ATTRIBUTES directive options DLLEXPORT and DLLIMPORT define a dynamic-link library's interface for processes that use them. The options can be assigned to module variables, COMMON blocks, and procedures. These directive options are available on Windows* and macOS systems.

!DIR$ ATTRIBUTES DLLEXPORT :: object[, object] ...

!DIR$ ATTRIBUTES DLLIMPORT :: object[, object] ...

object | Is the name of a module variable, COMMON block, or procedure. The name of a COMMON block must be enclosed in slashes.

DLLEXPORT and DLLIMPORT define the interface for the following dynamic-link libraries:

- DLL on Windows*

- DYLIB on macOS

DLLEXPORT specifies that procedures or data are being exported to other applications or dynamic libraries. This causes the compiler to produce efficient code; for example, eliminating the need on Windows systems for a module definition (.def) file to export symbols.

DLLEXPORT should be specified in the routine to which it applies. If the routine's implementation is in a submodule, specify DLLEXPORT in the parent module's INTERFACE block for the routine. If MODULE PROCEDURE is used in the submodule, the DLLEXPORT attribute will be inherited; otherwise you must also specify DLLEXPORT in the submodule routine.

Symbols defined in a DLL are imported by programs that use them. On Windows*, the program must link with the DLL import library (.lib).

The DLLIMPORT option is used inside the program unit that imports the symbol. DLLIMPORT is specified in a declaration, not a definition, since you cannot define a symbol you are importing.

## See Also

ATTRIBUTES
Syntax Rules for Compiler Directives