头文件
//
door.h
//
extern "C" __declspec(dllexport) int say_something(char *sth);
***********************************
//
door.cpp
//
#include<windows.h>
#include"door.h"
int say_something(char* sth)
{
MessageBox(NULL,"sth","hello",MB_OK);
return 0;
}
************************************
//
dllmain.cpp
//
#include<windows.h>
#include"door.h"
BOOL WINAPIENTRY DllMain(HINSTANCE hInst,DWORD reason,LPVOID lparam)
{
switch(reason)
{
case DLL_PROCESS_ATTACH:
say_something("i am here");
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}