dll动态库 入口出口流程介绍

BOOL APIENTRY DllMain( HMODULE hModule,

DWORDul_reason_for_call,

LPVOID lpReserved

)

{

switch(ul_reason_for_call)

{

case DLL_PROCESS_ATTACH:

//当这个DLL被映射到了进程的地址空间时

printf("DLL_PROCESS_ATTACH\n");

break;

case DLL_THREAD_ATTACH:

//一个线程正在被创建

printf("DLL_THREAD_ATTACH\n");

break;

case DLL_THREAD_DETACH:

//线程终结

printf("DLL_THREAD_DETACH\n");

break;

case DLL_PROCESS_DETACH:

//这个DLL从进程的地址空间中解除映射

printf("DLL_PROCESS_DETACH\n");

break;

}

return TRUE;

}

你可能感兴趣的:(dll动态库 入口出口流程介绍)