#include <windows.h> #include <stdio.h> BOOL APIENTRY DllMain(HMODULE 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: // 进程分离(只调用一次) break; } return TRUE; } extern "C" _declspec(dllexport) void Fun() { printf("Hello15PB"); }