The ATTRIBUTES directive options DLLEXPORT and DLLIMPORT define a dynamic-link library's (DLL) interface for processes that use them. The options can be assigned to module variables, COMMON blocks, and procedures. They take the following forms:
cDEC$ ATTRIBUTES DLLEXPORT :: object[, object] ...
cDEC$ ATTRIBUTES DLLIMPORT :: object[, object] ...
c |
Is one of the following: C (or c), !, or *. (See Syntax Rules for Compiler Directives.) |
object |
Is the name of a module variable, COMMON block, or procedure. The name of a COMMON block must be enclosed in slashes. |
DLLEXPORT specifies that procedures or data are being exported to other applications or DLLs. This causes the compiler to produce efficient code, eliminating the need for a module definition (.def) file to export symbols.
DLLEXPORT should be specified in the routine to which it applies.
Symbols defined in a DLL are imported by programs that use them. The program must link with the DLL import library (.lib) and use the DLLIMPORT option 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.
Building Applications: Creating and Using Fortran DLLs Overview, for details on working with DLL applications