__declspec(dllexport)

From RAD Studio
Jump to: navigation, search

Go Up to Keywords, Alphabetical Listing Index


Category

Modifiers (C++), Keyword Extensions, Storage Class Specifiers (C++)

Syntax

__declspec( dllexport ) declarator

The dllexport storage-class attribute is used for Microsoft C and C++ language compatibility. This attribute enables you to export functions, data, and objects from a DLL. The dllexport storage class may be applied to a template class or function, in which case it is considered to apply to every specialization of that template.

This attribute explicitly defines the DLL interface to its client, which can be the executable file or another DLL. Declaring functions as dllexport eliminates the need for a module-definition (.DEF) file, at least with respect to the specification of exported functions. When a class is marked dllexport, every inline function in the class is generated with an out-of-line body so that it may be called from outside of its defining DLL.

Note: dllexport replaces the __export keyword in the sense that it provides an easy and simple way of exporting functions without the need of a .DEF file, while also optimizing the code.

See Also