-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdllmain.cpp
50 lines (40 loc) · 1.18 KB
/
dllmain.cpp
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
45
46
47
48
49
50
#include "ComponentBaseImpl.h"
#include <string>
// -----------------------------------------------------------------------------
// --SECTION-- Export methods
// -----------------------------------------------------------------------------
long GetClassObject(const WCHAR_T* wsName, IComponentBase** pInterface) {
auto factory = ComponentRegister::instance().get(wsName);
if (!factory) {
return 0;
}
*pInterface = factory();
return 1;
}
long DestroyObject(IComponentBase** pIntf) {
delete *pIntf;
return 0;
}
const WCHAR_T* GetClassNames() {
return ComponentRegister::class_names().c_str();
}
// -----------------------------------------------------------------------------
// --SECTION-- DllMain
// -----------------------------------------------------------------------------
#ifdef _MSC_VER
#include <Windows.h>
BOOL APIENTRY DllMain(
HMODULE,
DWORD ul_reason_for_call,
LPVOID) {
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif