DLL_INTERFACE Language Extension

dll.h

Starts the DLL interface section.

The DLL_INTERFACE macro starts the DLL interface section and tells the linker that a DLL image should be produced instead of the standard executable image. The DLL interface section must have the following general layout:

DLL_INTERFACE

// Declarations of global symbols which should be exported,
// and prototypes of functions which should be exported.

DLL_ID identification_number
DLL_VERSION major_version_number, minor_version_number
DLL_EXPORTS list_of_exported_symbols

DLL_IMPLEMENTATION

// Now the implementation follows
In principle, in addition to function prototypes, it is legal to put function implementations in the DLL interface section as well, although this is not a good practice from the aspect of readability and good structuring. So, a well-designed interface should contain only prototypes.

Note that just putting a symbol declaration or a function prototype into the DLL interface section does not mean that this symbol or function will automatically be exported: you need to put the names of all objects which should be exported after the DLL_EXPORTS interface item. Also, note that DLL_IMPLEMENTATION ends the interface section, so any symbol declared after it can not be exported from the DLL.


See also: DLL_ID, DLL_VERSION, DLL_EXPORTS, DLL_IMPLEMENTATION