Last active
September 26, 2022 23:14
-
-
Save bohops/d351907facb590792c11d2a1bac880b0 to your computer and use it in GitHub Desktop.
Simple Export Dll Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "pch.h" | |
#define EXPORT extern "C" __declspec(dllexport) | |
EXPORT void HelloWorld() | |
{ | |
MessageBox(0, L"Hello World!", 0, 0); | |
} | |
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) | |
{ | |
switch (ul_reason_for_call) | |
{ | |
case DLL_PROCESS_ATTACH: | |
HelloWorld(); | |
break; | |
case DLL_THREAD_ATTACH: | |
break; | |
case DLL_THREAD_DETACH: | |
break; | |
case DLL_PROCESS_DETACH: | |
break; | |
} | |
return TRUE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment