Skip to content

Instantly share code, notes, and snippets.

@bohops
Last active September 26, 2022 23:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bohops/d351907facb590792c11d2a1bac880b0 to your computer and use it in GitHub Desktop.
Save bohops/d351907facb590792c11d2a1bac880b0 to your computer and use it in GitHub Desktop.
Simple Export Dll Example
#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