First set of licensing changes
[mono.git] / mono / utils / gc_wrapper.h
1 /* 
2  * Copyright 2004-2011 Novell, Inc (http://www.novell.com)
3  * Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
4  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
5  */
6 #ifndef __MONO_OS_GC_WRAPPER_H__
7 #define __MONO_OS_GC_WRAPPER_H__
8
9 #include <config.h>
10 #include <stdlib.h>
11
12 #ifdef HAVE_BOEHM_GC
13
14 #       ifdef _MSC_VER
15 #               include <winsock2.h>
16 #       else
17                 /* libgc specifies this on the command line,
18                  * so we must define it ourselfs
19                 */
20 #               define GC_GCJ_SUPPORT
21 #       endif
22
23         /*
24          * Local allocation is only beneficial if we have __thread
25          * We had to fix a bug with include order in libgc, so only do
26          * it if it is the included one.
27          */
28         
29 #       if defined(HAVE_KW_THREAD) && !defined(__powerpc__)
30         /* The local alloc stuff is in pthread_support.c, but solaris uses solaris_threads.c */
31         /* It is also disabled on solaris/x86 by libgc/configure.ac */
32         /* 
33                  * ARM has no definition for some atomic functions in gc_locks.h and
34                  * support is also disabled in libgc/configure.ac.
35                  */
36 #       if !defined(__sparc__) && !defined(__sun) && !defined(__arm__) && !defined(__mips__)
37 #                   define GC_REDIRECT_TO_LOCAL
38 #       endif
39 #       endif
40
41 #       define GC_INSIDE_DLL
42 #       include <gc.h>
43 #       include <gc_typed.h>
44 #       include <gc_mark.h>
45 #       include <gc_gcj.h>
46
47 #if defined(HOST_WIN32)
48 #define CreateThread GC_CreateThread
49 #endif
50
51 #elif defined(HAVE_SGEN_GC)
52
53 #else /* not Boehm and not sgen GC */
54 #endif
55
56 #endif