原来的 DLLENTRY解释

来源:互联网 发布:淘宝信誉平台 编辑:程序博客网 时间:2024/05/01 05:38

地址:http://msdn.microsoft.com/zh-cn/library/aa909718

Other versions of this page are also available for the following:
  • Windows Embedded CE 6.0 R3
Windows Mobile Not SupportedWindows Embedded CE Supported
8/27/2008

This macro definition specifies the function that is used as the entry point for a .dll file if the value of TARGETTYPE is set equal to DYNLINK.

If no value is given for DLLENTRY, the default value is _DllMainCRTStartup.

Values

ValueDescription

_DllMainCRTStartup

Preferred C Runtime entry point for a DLL.

This entry point is defined in the C Runtime. It initializes the C Runtime and calls global initializers on process attach. It chains to DllMain. It deinitializes the C Runtime and calls global destructors on process detach.

Your DLL may define, but does not need to export, a 'DllMain' function with the following signature:

BOOL DllMain(HANDLE hInstDll, DWORD dwReason, LPVOID lpvReserved);

DllMain

Aa909718.note(en-US,WinEmbedded.60).gifNote:
The actual name of the function is not significant. By convention, the name 'DllMain' is used for DLL entry points. The name of any function defined in your DLL can be used as an entry point.

Direct entry point for a DLL.

If you use the C Runtime in your application, it is responsible for performing any initialization of the C Runtime at process attach, and for deinitializing the C Runtime at process detach.

Aa909718.note(en-US,WinEmbedded.60).gifNote:
Global initializers are normally called by the C Runtime initialization code, so global variables will be initialized to zero instead of their expected value. If you are not using the C Runtime, use this entry point.

Your DLL must define, but does not need to export, a 'DllMain' function with the following signature:

BOOL DllMain(HANDLE hInstDll, DWORD dwReason, LPVOID lpvReserved);

_DllEntryCRTStartup

Basic C Runtime entry point for a DLL.

This entry point is defined in the C Runtime.

It initializes the C Runtime and calls global initializers on process attach. It chains to DllEntry. It deinitializes the C Runtime and calls global destructors on process detach. This entry point does not do any exception handling and does not chain to _pRawDllMain, which is required by some libraries such as MFC and ATL.

Your DLL must define, but does not need to export, a 'DllEntry' function with the following signature:

BOOL DllEntry(HANDLE hInstDll, DWORD dwReason, LPVOID lpvReserved);
0 0