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
To initialize non-MFC DLLs, your DLL source code must contain a function called DllMain. The following code presents a basic skeleton showing what the definition of DllMain might look like:
BOOL APIENTRY DllMain(HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
switch( ul_reason_for_call ) {
case DLL_PROCESS_ATTACH:
.
.
.
case DLL_THREAD_ATTACH:
.
.
.
case DLL_THREAD_DETACH:
.
.
.
case DLL_PROCESS_DETACH:
.
.
.
}
return TRUE;
}
Note The Win32 SDK documentation for DllEntryPoint says that the actual name of the entry-point function must be specified on the linker command line with the /ENTRY switch. With Visual C++, you do not need to use the /ENTRY switch if the name of your entry-point function is DllMain. In fact, if you do use the /ENTRY switch and name your entry-point function something other than DllMain, the C run-time library will not get initialized properly.