Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 1.82 KB

dll-import-and-export-functions.md

File metadata and controls

42 lines (34 loc) · 1.82 KB
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
DLL Import and Export Functions | Microsoft Docs
11/04/2016
cpp-language
article
C++
DLLs [C++], importing
dllimport attribute [C++], storage-class attribute
DLL exports [C++]
declaring functions, with dllexport and dllimport
extended storage-class attributes
dllexport attribute [C++], storage-class attribute
08d164b9-770a-4e14-afeb-c6f21d9e33e4
9
mikeblome
mblome
ghogen

DLL Import and Export Functions

Microsoft Specific

The most complete and up-to-date information on this topic can be found in dllexport, dllimport.

The dllimport and dllexport storage-class modifiers are Microsoft-specific extensions to the C language. These modifiers explicitly define the DLL's interface to its client (the executable file or another DLL). Declaring functions as dllexport eliminates the need for a module-definition (.DEF) file. You can also use the dllimport and dllexport modifiers with data and objects.

The dllimport and dllexport storage-class modifiers must be used with the extended attribute syntax keyword, __declspec, as shown in this example:

#define DllImport   __declspec( dllimport )  
#define DllExport   __declspec( dllexport )  
  
DllExport void func();  
DllExport int i = 10;  
DllExport int j;  
DllExport int n;  

For specific information about the syntax for extended storage-class modifiers, see Extended Storage-Class Attributes.

END Microsoft Specific

See Also

C Function Definitions