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