-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcpp.hpp
48 lines (38 loc) · 903 Bytes
/
gcpp.hpp
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
#ifndef GCPP_HPP
#define GCPP_HPP
#ifndef __cplusplus
# error "Garbage collecting is only works for C++."
#endif
#undef gc_new
#undef gc_collect
#if !defined(ENABLE_GCPP_V0) &&\
!defined(ENABLE_GCPP_V1)
# define ENABLE_GCPP_DEFAULT
#endif
#ifdef ENABLE_GCPP_DEFAULT
# define ENABLE_GCPP_V1
#endif
//#define ENABLE_GCPP_V0
#if defined(ENABLE_GCPP_V0)
/**
* Enable gcpp version 0
*/
# include "gcpp.0/gc.hpp"
# define gcnew new(::GC)
# define gccollect() gc::collect()
#elif defined(ENABLE_GCPP_V1)
/**
* Enable gcpp version 1
*/
# include "gcpp.1/gc.hpp"
# ifdef GC_DEBUG
# define gcnew new(::GC(), cout, __FILE__, __LINE__)
# else
# define gcnew new(::GC())
# endif
# define gccollect()
#endif
#if !defined(gcnew) || !defined(gccollect)
# error "`gc_new` and `gc_collect` both need to be defined by the end of this file."
#endif
#endif