Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
| Overview | How Do I | FAQ | Details | Sample
You can export data, functions, classes, or class member functions from a DLL by using the __declspec(dllexport) keyword. If you use __declspec(dllexport), you do not need a .DEF file for exports.
To export functions, the __declspec(dllexport) keyword must appear to the left of the calling-convention keyword, if a keyword is specified. For example:
__declspec(dllexport) void __cdecl Function1(void);
To export all the public data members and member functions in a class, the keyword must appear to the left of the class name as follows:
class __declspec(dllexport) CExampleExport : public CObject
{ ... class definition ... };
When building your DLL, you typically create a header file that contains the function prototypes and/or classes you are exporting, and add the __declspec(dllexport) to the declarations in the header file. To make your code more readable, define a macro for __declspec(dllexport) and then use the macro with each symbol you are exporting:
#define DllExport __declspec( dllexport )
__declspec(dllexport) stores function names in the DLL’s export table. If you want to optimize the table’s size, see Export Functions From a DLL By Ordinal Rather Than By Name.
Note When porting DLL source code from Win16 to Win32, replace each instance of __export with __declspec(dllexport).
What do you want to do?
Prepare the MFC DLL for use by an application, or Prepare the Win32 DLL for use by an application