]>
Commit | Line | Data |
---|---|---|
0cc66b6c VZ |
1 | /* |
2 | * Name: wx/dlimpexp.h | |
3 | * Purpose: Macros for declaring DLL-imported/exported functions | |
4 | * Author: Vadim Zeitlin | |
5 | * Modified by: | |
6 | * Created: 16.10.2003 (extracted from wx/defs.h) | |
7 | * RCS-ID: $Id$ | |
77ffb593 | 8 | * Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> |
65571936 | 9 | * Licence: wxWindows licence |
0cc66b6c VZ |
10 | */ |
11 | ||
12 | /* | |
13 | This is a C file, not C++ one, do not use C++ comments here! | |
14 | */ | |
15 | ||
16 | #ifndef _WX_DLIMPEXP_H_ | |
17 | #define _WX_DLIMPEXP_H_ | |
18 | ||
0ff20b9f | 19 | #if defined(__WINDOWS__) |
0cc66b6c VZ |
20 | /* |
21 | __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well | |
22 | as VC++ and gcc | |
23 | */ | |
24 | # if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) || defined(__WATCOMC__) | |
25 | # define WXEXPORT __declspec(dllexport) | |
26 | # define WXIMPORT __declspec(dllimport) | |
27 | # else /* compiler doesn't support __declspec() */ | |
28 | # define WXEXPORT | |
29 | # define WXIMPORT | |
30 | # endif | |
31 | #elif defined(__WXPM__) | |
32 | # if defined (__WATCOMC__) | |
33 | # define WXEXPORT __declspec(dllexport) | |
34 | /* | |
35 | __declspec(dllimport) prepends __imp to imported symbols. We do NOT | |
36 | want that! | |
37 | */ | |
38 | # define WXIMPORT | |
fd928524 DW |
39 | # elif defined(__EMX__) |
40 | # define WXEXPORT | |
41 | # define WXIMPORT | |
0cc66b6c VZ |
42 | # elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) |
43 | # define WXEXPORT _Export | |
44 | # define WXIMPORT _Export | |
45 | # endif | |
46 | #elif defined(__WXMAC__) || defined(__WXCOCOA__) | |
47 | # ifdef __MWERKS__ | |
48 | # define WXEXPORT __declspec(export) | |
49 | # define WXIMPORT __declspec(import) | |
50 | # endif | |
7275146d MW |
51 | #elif defined(__CYGWIN__) |
52 | # define WXEXPORT __declspec(dllexport) | |
53 | # define WXIMPORT __declspec(dllimport) | |
0ff20b9f VS |
54 | #elif defined(HAVE_VISIBILITY) |
55 | # define WXEXPORT __attribute__ ((visibility("default"))) | |
56 | # define WXIMPORT | |
0cc66b6c VZ |
57 | #endif |
58 | ||
59 | /* for other platforms/compilers we don't anything */ | |
60 | #ifndef WXEXPORT | |
61 | # define WXEXPORT | |
62 | # define WXIMPORT | |
63 | #endif | |
64 | ||
65 | /* | |
77ffb593 | 66 | We support building wxWidgets as a set of several libraries but we don't |
0cc66b6c VZ |
67 | support arbitrary combinations of libs/DLLs: either we build all of them as |
68 | DLLs (in which case WXMAKINGDLL is defined) or none (it isn't). | |
69 | ||
70 | However we have a problem because we need separate WXDLLEXPORT versions for | |
71 | different libraries as, for example, wxString class should be dllexported | |
72 | when compiled in wxBase and dllimported otherwise, so we do define separate | |
73 | WXMAKING/USINGDLL_XYZ constants for each component XYZ. | |
74 | */ | |
75 | #ifdef WXMAKINGDLL | |
76 | # if wxUSE_BASE | |
77 | # define WXMAKINGDLL_BASE | |
78 | # endif | |
79 | ||
80 | # define WXMAKINGDLL_NET | |
81 | # define WXMAKINGDLL_CORE | |
82 | # define WXMAKINGDLL_ADV | |
f5a9eef7 | 83 | # define WXMAKINGDLL_QA |
0cc66b6c VZ |
84 | # define WXMAKINGDLL_ODBC |
85 | # define WXMAKINGDLL_DBGRID | |
86 | # define WXMAKINGDLL_HTML | |
0ae4d121 | 87 | # define WXMAKINGDLL_GL |
0cc66b6c | 88 | # define WXMAKINGDLL_XML |
c846884b | 89 | # define WXMAKINGDLL_XRC |
5e4903f5 | 90 | # define WXMAKINGDLL_AUI |
3b2cb431 | 91 | # define WXMAKINGDLL_RICHTEXT |
c220a8ec | 92 | # define WXMAKINGDLL_MEDIA |
c079af66 | 93 | # define WXMAKINGDLL_STC |
0cc66b6c VZ |
94 | #endif /* WXMAKINGDLL */ |
95 | ||
96 | /* | |
97 | WXDLLEXPORT maps to export declaration when building the DLL, to import | |
98 | declaration if using it or to nothing at all if we don't use wxWin as DLL | |
99 | */ | |
100 | #ifdef WXMAKINGDLL_BASE | |
101 | # define WXDLLIMPEXP_BASE WXEXPORT | |
102 | # define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type | |
103 | #elif defined(WXUSINGDLL) | |
104 | # define WXDLLIMPEXP_BASE WXIMPORT | |
105 | # define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type | |
106 | #else /* not making nor using DLL */ | |
107 | # define WXDLLIMPEXP_BASE | |
108 | # define WXDLLIMPEXP_DATA_BASE(type) type | |
109 | #endif | |
110 | ||
111 | #ifdef WXMAKINGDLL_NET | |
112 | # define WXDLLIMPEXP_NET WXEXPORT | |
113 | # define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type | |
114 | #elif defined(WXUSINGDLL) | |
115 | # define WXDLLIMPEXP_NET WXIMPORT | |
116 | # define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type | |
117 | #else /* not making nor using DLL */ | |
118 | # define WXDLLIMPEXP_NET | |
119 | # define WXDLLIMPEXP_DATA_NET(type) type | |
120 | #endif | |
121 | ||
122 | #ifdef WXMAKINGDLL_CORE | |
123 | # define WXDLLIMPEXP_CORE WXEXPORT | |
124 | # define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type | |
125 | #elif defined(WXUSINGDLL) | |
126 | # define WXDLLIMPEXP_CORE WXIMPORT | |
127 | # define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type | |
128 | #else /* not making nor using DLL */ | |
129 | # define WXDLLIMPEXP_CORE | |
130 | # define WXDLLIMPEXP_DATA_CORE(type) type | |
131 | #endif | |
132 | ||
133 | #ifdef WXMAKINGDLL_ADV | |
134 | # define WXDLLIMPEXP_ADV WXEXPORT | |
135 | # define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type | |
136 | #elif defined(WXUSINGDLL) | |
137 | # define WXDLLIMPEXP_ADV WXIMPORT | |
138 | # define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type | |
139 | #else /* not making nor using DLL */ | |
140 | # define WXDLLIMPEXP_ADV | |
141 | # define WXDLLIMPEXP_DATA_ADV(type) type | |
142 | #endif | |
143 | ||
144 | #ifdef WXMAKINGDLL_ODBC | |
145 | # define WXDLLIMPEXP_ODBC WXEXPORT | |
146 | # define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type | |
147 | #elif defined(WXUSINGDLL) | |
148 | # define WXDLLIMPEXP_ODBC WXIMPORT | |
149 | # define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type | |
150 | #else /* not making nor using DLL */ | |
151 | # define WXDLLIMPEXP_ODBC | |
152 | # define WXDLLIMPEXP_DATA_ODBC(type) type | |
153 | #endif | |
154 | ||
61639efb VZ |
155 | #ifdef WXMAKINGDLL_QA |
156 | # define WXDLLIMPEXP_QA WXEXPORT | |
157 | # define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type | |
158 | #elif defined(WXUSINGDLL) | |
159 | # define WXDLLIMPEXP_QA WXIMPORT | |
160 | # define WXDLLIMPEXP_DATA_QA(type) WXIMPORT type | |
161 | #else /* not making nor using DLL */ | |
162 | # define WXDLLIMPEXP_QA | |
163 | # define WXDLLIMPEXP_DATA_QA(type) type | |
164 | #endif | |
165 | ||
0cc66b6c VZ |
166 | #ifdef WXMAKINGDLL_DBGRID |
167 | # define WXDLLIMPEXP_DBGRID WXEXPORT | |
168 | # define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type | |
169 | #elif defined(WXUSINGDLL) | |
170 | # define WXDLLIMPEXP_DBGRID WXIMPORT | |
171 | # define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type | |
172 | #else /* not making nor using DLL */ | |
173 | # define WXDLLIMPEXP_DBGRID | |
174 | # define WXDLLIMPEXP_DATA_DBGRID(type) type | |
175 | #endif | |
176 | ||
177 | #ifdef WXMAKINGDLL_HTML | |
178 | # define WXDLLIMPEXP_HTML WXEXPORT | |
179 | # define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type | |
180 | #elif defined(WXUSINGDLL) | |
181 | # define WXDLLIMPEXP_HTML WXIMPORT | |
182 | # define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type | |
183 | #else /* not making nor using DLL */ | |
184 | # define WXDLLIMPEXP_HTML | |
185 | # define WXDLLIMPEXP_DATA_HTML(type) type | |
186 | #endif | |
187 | ||
188 | #ifdef WXMAKINGDLL_GL | |
189 | # define WXDLLIMPEXP_GL WXEXPORT | |
190 | #elif defined(WXUSINGDLL) | |
191 | # define WXDLLIMPEXP_GL WXIMPORT | |
192 | #else /* not making nor using DLL */ | |
193 | # define WXDLLIMPEXP_GL | |
194 | #endif | |
195 | ||
196 | #ifdef WXMAKINGDLL_XML | |
197 | # define WXDLLIMPEXP_XML WXEXPORT | |
198 | #elif defined(WXUSINGDLL) | |
199 | # define WXDLLIMPEXP_XML WXIMPORT | |
200 | #else /* not making nor using DLL */ | |
201 | # define WXDLLIMPEXP_XML | |
202 | #endif | |
203 | ||
c846884b RD |
204 | #ifdef WXMAKINGDLL_XRC |
205 | # define WXDLLIMPEXP_XRC WXEXPORT | |
206 | #elif defined(WXUSINGDLL) | |
207 | # define WXDLLIMPEXP_XRC WXIMPORT | |
208 | #else /* not making nor using DLL */ | |
209 | # define WXDLLIMPEXP_XRC | |
210 | #endif | |
211 | ||
5e4903f5 JS |
212 | #ifdef WXMAKINGDLL_AUI |
213 | # define WXDLLIMPEXP_AUI WXEXPORT | |
214 | #elif defined(WXUSINGDLL) | |
215 | # define WXDLLIMPEXP_AUI WXIMPORT | |
216 | #else /* not making nor using DLL */ | |
217 | # define WXDLLIMPEXP_AUI | |
218 | #endif | |
219 | ||
3b2cb431 JS |
220 | #ifdef WXMAKINGDLL_RICHTEXT |
221 | # define WXDLLIMPEXP_RICHTEXT WXEXPORT | |
222 | #elif defined(WXUSINGDLL) | |
223 | # define WXDLLIMPEXP_RICHTEXT WXIMPORT | |
224 | #else /* not making nor using DLL */ | |
225 | # define WXDLLIMPEXP_RICHTEXT | |
226 | #endif | |
227 | ||
ff2b312f RN |
228 | #ifdef WXMAKINGDLL_MEDIA |
229 | # define WXDLLIMPEXP_MEDIA WXEXPORT | |
230 | #elif defined(WXUSINGDLL) | |
231 | # define WXDLLIMPEXP_MEDIA WXIMPORT | |
232 | #else /* not making nor using DLL */ | |
233 | # define WXDLLIMPEXP_MEDIA | |
234 | #endif | |
235 | ||
c079af66 VZ |
236 | #ifdef WXMAKINGDLL_STC |
237 | #define WXDLLIMPEXP_STC WXEXPORT | |
238 | #elif defined(WXUSINGDLL) | |
239 | #define WXDLLIMPEXP_STC WXIMPORT | |
240 | #else /* not making nor using DLL */ | |
241 | #define WXDLLIMPEXP_STC | |
242 | #endif | |
243 | ||
b5dbe15d VS |
244 | /* GCC warns about using __attribute__ on forward declarations, so we need |
245 | another set of macros for them: */ | |
0ff20b9f VS |
246 | #if defined(HAVE_VISIBILITY) |
247 | #define WXDLLIMPEXP_FWD_BASE | |
248 | #define WXDLLIMPEXP_FWD_NET | |
249 | #define WXDLLIMPEXP_FWD_CORE | |
250 | #define WXDLLIMPEXP_FWD_ADV | |
251 | #define WXDLLIMPEXP_FWD_QA | |
252 | #define WXDLLIMPEXP_FWD_ODBC | |
253 | #define WXDLLIMPEXP_FWD_DBGRID | |
254 | #define WXDLLIMPEXP_FWD_HTML | |
255 | #define WXDLLIMPEXP_FWD_GL | |
256 | #define WXDLLIMPEXP_FWD_XML | |
257 | #define WXDLLIMPEXP_FWD_XRC | |
258 | #define WXDLLIMPEXP_FWD_AUI | |
259 | #define WXDLLIMPEXP_FWD_RICHTEXT | |
260 | #define WXDLLIMPEXP_FWD_MEDIA | |
261 | #define WXDLLIMPEXP_FWD_STC | |
262 | #else | |
263 | #define WXDLLIMPEXP_FWD_BASE WXDLLIMPEXP_BASE | |
264 | #define WXDLLIMPEXP_FWD_NET WXDLLIMPEXP_NET | |
265 | #define WXDLLIMPEXP_FWD_CORE WXDLLIMPEXP_CORE | |
266 | #define WXDLLIMPEXP_FWD_ADV WXDLLIMPEXP_ADV | |
267 | #define WXDLLIMPEXP_FWD_QA WXDLLIMPEXP_QA | |
268 | #define WXDLLIMPEXP_FWD_ODBC WXDLLIMPEXP_ODBC | |
269 | #define WXDLLIMPEXP_FWD_DBGRID WXDLLIMPEXP_DBGRID | |
270 | #define WXDLLIMPEXP_FWD_HTML WXDLLIMPEXP_HTML | |
271 | #define WXDLLIMPEXP_FWD_GL WXDLLIMPEXP_GL | |
272 | #define WXDLLIMPEXP_FWD_XML WXDLLIMPEXP_XML | |
273 | #define WXDLLIMPEXP_FWD_XRC WXDLLIMPEXP_XRC | |
274 | #define WXDLLIMPEXP_FWD_AUI WXDLLIMPEXP_AUI | |
275 | #define WXDLLIMPEXP_FWD_RICHTEXT WXDLLIMPEXP_RICHTEXT | |
276 | #define WXDLLIMPEXP_FWD_MEDIA WXDLLIMPEXP_MEDIA | |
277 | #define WXDLLIMPEXP_FWD_STC WXDLLIMPEXP_STC | |
278 | #endif | |
b5dbe15d | 279 | |
0cc66b6c VZ |
280 | /* for backwards compatibility, define suffix-less versions too */ |
281 | #define WXDLLEXPORT WXDLLIMPEXP_CORE | |
282 | #define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE | |
283 | ||
284 | #endif /* _WX_DLIMPEXP_H_ */ | |
285 |