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