ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/beaengine/export.h
Revision: 984
Committed: Sun Mar 16 23:35:10 2014 UTC (11 years, 6 months ago) by alloc
Content type: text/x-chdr
File size: 4924 byte(s)
Log Message:
Daodan: TV code

File Contents

# Content
1 /**
2 * @file export.h
3 * @author igor.gutnik@gmail.com
4 * @date Mon Sep 22 09:28:54 2008
5 *
6 * @brief This file sets things up for C dynamic library function definitions and
7 * static inlined functions
8 *
9 * This file is part of BeaEngine.
10 *
11 * BeaEngine is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * BeaEngine is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with BeaEngine. If not, see <http://www.gnu.org/licenses/>. */
23
24 #ifndef __BEA_EXPORT_H__
25 #define __BEA_EXPORT_H__
26
27
28 /* Set up for C function definitions, even when using C++ */
29
30 #ifdef __cplusplus
31 #define CPP_VISIBLE_BEGIN extern "C" {
32 #define CPP_VISIBLE_END }
33 #else
34 #define CPP_VISIBLE_BEGIN
35 #define CPP_VISIBLE_END
36 #endif
37
38 #if defined(_MSC_VER)
39 #pragma warning( disable: 4251 )
40 #endif
41
42 /* Some compilers use a special export keyword */
43 #ifndef bea__api_export__
44 # if defined(__BEOS__)
45 # if defined(__GNUC__)
46 # define bea__api_export__ __declspec(dllexport)
47 # else
48 # define bea__api_export__ __declspec(export)
49 # endif
50 # elif defined(_WIN32) || defined(_WIN64)
51 # ifdef __BORLANDC__
52 # define bea__api_export__ __declspec(dllexport)
53 # define bea__api_import__ __declspec(dllimport)
54 # elif defined(__WATCOMC__)
55 # define bea__api_export__ __declspec(dllexport)
56 # define bea__api_import__
57 # else
58 # define bea__api_export__ __declspec(dllexport)
59 # define bea__api_import__ __declspec(dllimport)
60 # endif
61 # elif defined(__OS2__)
62 # ifdef __WATCOMC__
63 # define bea__api_export__ __declspec(dllexport)
64 # define bea__api_import__
65 # else
66 # define bea__api_export__
67 # define bea__api_import__
68 # endif
69 # else
70 # if defined(_WIN32) && defined(__GNUC__) && __GNUC__ >= 4
71 # define bea__api_export__ __attribubea__ ((visibility("default")))
72 # define bea__api_import__ __attribubea__ ((visibility("default")))
73 # else
74 # define bea__api_export__
75 # define bea__api_import__
76 # endif
77 # endif
78 #endif
79
80 /* Use C calling convention by default*/
81
82 #ifndef __bea_callspec__
83 #if defined(BEA_USE_STDCALL)
84 #if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64)
85 #if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__POCC__)
86 #define __bea_callspec__ __stdcall
87 #else
88 #define __bea_callspec__
89 #endif
90 #else
91 #ifdef __OS2__
92 #define __bea_callspec__ _System
93 #else
94 #define __bea_callspec__
95 #endif
96 #endif
97 #else
98 #define __bea_callspec__
99 #endif
100 #endif
101
102 #ifdef __SYMBIAN32__
103 # ifndef EKA2
104 # undef bea__api_export__
105 # undef bea__api_import__
106 # define bea__api_export__
107 # define bea__api_import__
108 # elif !defined(__WINS__)
109 # undef bea__api_export__
110 # undef bea__api_import__
111 # define bea__api_export__ __declspec(dllexport)
112 # define bea__api_import__ __declspec(dllexport)
113 # endif /* !EKA2 */
114 #endif /* __SYMBIAN32__ */
115
116
117 #if defined(__GNUC__) && (__GNUC__ > 2)
118 #define BEA_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1))
119 #define BEA_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0))
120 #else
121 #define BEA_EXPECT_CONDITIONAL(c) (c)
122 #define BEA_UNEXPECT_CONDITIONAL(c) (c)
123 #endif
124
125
126 /* Set up compiler-specific options for inlining functions */
127 #ifndef BEA_HAS_INLINE
128 #if defined(__GNUC__) || defined(__POCC__) || defined(__WATCOMC__) || defined(__SUNPRO_C)
129 #define BEA_HAS_INLINE
130 #else
131 /* Add any special compiler-specific cases here */
132 #if defined(_MSC_VER) || defined(__BORLANDC__) || \
133 defined(__DMC__) || defined(__SC__) || \
134 defined(__WATCOMC__) || defined(__LCC__) || \
135 defined(__DECC) || defined(__EABI__)
136 #ifndef __inline__
137 #define __inline__ __inline
138 #endif
139 #define BEA_HAS_INLINE
140 #else
141 #if !defined(__MRC__) && !defined(_SGI_SOURCE)
142 #ifndef __inline__
143 #define __inline__ inline
144 #endif
145 #define BEA_HAS_INLINE
146 #endif /* Not a funky compiler */
147 #endif /* Visual C++ */
148 #endif /* GNU C */
149 #endif /* CACHE_HAS_INLINE */
150
151 /* If inlining isn't supported, remove "__inline__", turning static
152 inlined functions into static functions (resulting in code bloat
153 in all files which include the offending header files)
154 */
155 #ifndef BEA_HAS_INLINE
156 #define __inline__
157 #endif
158
159 /* fix a bug with gcc under windows */
160
161 #if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64)
162 #if defined(__MINGW32__)
163 #define const__
164 #else
165 #define const__ const
166 #endif
167 #else
168 #define const__ const
169 #endif
170
171
172
173 #endif