|
|
dllimport, dllexport
Microsoft Specific
__declspec( dllimport ) declarator
__declspec( dllexport ) declarator
The dllexport and dllimport storage-class attributes are Microsoft-specific extensions to the C and C++ languages. They enable you to export and import functions, data, and objects to and from a DLL. These attributes explicitly define the DLL’s 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. Note that dllexport replaces the __export keyword.
The declaration of dllexport and dllimport uses extended attribute syntax.Example
// Example of the dllimport and dllexport class attributes
__declspec( dllimport ) int i;
__declspec( dllexport ) void func();
extern "C" _declspec(dllexport) LRESULT KeyBoardProc(int nCode,WPARAM wParam,LPARAM lParam)
{
if(nCode==HC_ACTION)
{
}
return 0;
}
|
|