blob: 0c0240685afdaa9b6f34b931df8e3b2ce1c61d73 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
//
// This is a C++ version of the code in dll.c. NOTE that you need to put
// extern "C" { ... } around DllMain or it will not be called when your
// Dll starts up! (It will get name mangled as a C++ function and the C
// default version in libmingw32.a will get called instead.)
//
#include <windows.h>
#include <iostream>
extern "C" {
BOOL WINAPI
DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
cout << "Dll Attached" << endl ;
break;
case DLL_PROCESS_DETACH:
cout << "Dll Detached" << endl ;
break;
case DLL_THREAD_ATTACH:
printf ("DLL Thread Attached.\n");
break;
case DLL_THREAD_DETACH:
printf ("DLL Thread Detached.\n");
break;
}
return TRUE;
}
void
Test ()
{
printf ("Test Function called!\n");
}
};
|