1 /**
2  * \file
3  * DllMain entry point.
4  *
5  * (C) 2002-2003 Ximian, Inc.
6  * (C) 2003-2006 Novell, Inc.
7  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
8  */
9 
10 #include <mono/metadata/coree.h>
11 #include <mono/metadata/gc-internals.h>
12 #include <mono/metadata/domain-internals.h>
13 #include <mono/utils/mono-threads.h>
14 #include "mini.h"
15 #include "mini-runtime.h"
16 
17 #ifdef HOST_WIN32
18 #include <windows.h>
19 
DllMain(HMODULE module_handle,DWORD reason,LPVOID reserved)20 BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
21 {
22 	if (!mono_gc_dllmain (module_handle, reason, reserved))
23 		return FALSE;
24 
25 	switch (reason)
26 	{
27 	case DLL_PROCESS_ATTACH:
28 		mono_install_runtime_load (mini_init);
29 		break;
30 	case DLL_PROCESS_DETACH:
31 		if (coree_module_handle)
32 			FreeLibrary (coree_module_handle);
33 		break;
34 	case DLL_THREAD_DETACH:
35 		mono_thread_info_detach ();
36 		break;
37 
38 	}
39 	return TRUE;
40 }
41 #endif
42 
43