DLL_EXPORTS Language Extension

dll.h

Exports symbols from the DLL.

The DLL_EXPORTS macro is used for defining the list of symbols which will be exported from the DLL. 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.

DLL_EXPORTS must be followed by a list of symbols which should be exported from the DLL. It is possible to exports function names, array names, or addresses of global variables (i.e. names of global variables preceded by the address operator '&'). More precisely, all types of pointers may be exported; functions and arrays are always referenced automatically. For example, suppose that the interface section contains the following declarations:

int foofunc (int fooarg1, const char *fooarg2);
char foostring [] = "Foo";
int fooarray [5] = {1, 2, 3, 4, 5};
unsigned short fooglbvar;
Then, to export these symbols from the DLL, use:
DLL_EXPORTS foofunc, foostring, fooarray, &fooglbvar
Each item in the DLL_EXPORTS declaration is assigned an index number, which is important later for importing symbols from the DLL (see _DLL_call, _DLL_call_attr, _DLL_reference, and _DLL_glbvar for info about how to import symbols from the DLL). The first item gets the index number 0, the second gets the index number 1, etc. So, in the above example, foofunc, foostring, fooarray, and fooglbvar get the index numbers 0, 1, 2, and 3, respectively.

DLL_EXPORTS must appear at the very end of the DLL interface section, just after the DLL_VERSION entry, and just before the DLL_IMPLEMENTATION delimiter, which terminates the DLL interface section and starts the implementation section. See DLL_INTERFACE for a detailed layout of the DLL interface structure.


See also: DLL_INTERFACE, _DLL_entry