]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dlimpexp.h
Removed OnSelect
[wxWidgets.git] / include / wx / dlimpexp.h
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$
8 * Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
9 * Licence: wxWindows licence
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
19 #if defined(HAVE_VISIBILITY)
20 # define WXEXPORT __attribute__ ((visibility("default")))
21 # define WXIMPORT __attribute__ ((visibility("default")))
22 #elif defined(__WINDOWS__)
23 /*
24 __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well
25 as VC++.
26 */
27 # if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__)
28 # define WXEXPORT __declspec(dllexport)
29 # define WXIMPORT __declspec(dllimport)
30 /*
31 While gcc also supports __declspec(dllexport), it creates unusably huge
32 DLL files since gcc 4.5 (while taking horribly long amounts of time),
33 see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601. Because of this
34 we rely on binutils auto export/import support which seems to work
35 quite well for 4.5+.
36 */
37 # elif defined(__GNUC__) && !wxCHECK_GCC_VERSION(4, 5)
38 /*
39 __declspec could be used here too but let's use the native
40 __attribute__ instead for clarity.
41 */
42 # define WXEXPORT __attribute__((dllexport))
43 # define WXIMPORT __attribute__((dllimport))
44 # endif
45 #elif defined(__WXPM__)
46 # if defined (__WATCOMC__)
47 # define WXEXPORT __declspec(dllexport)
48 /*
49 __declspec(dllimport) prepends __imp to imported symbols. We do NOT
50 want that!
51 */
52 # define WXIMPORT
53 # elif defined(__EMX__)
54 # define WXEXPORT
55 # define WXIMPORT
56 # elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
57 # define WXEXPORT _Export
58 # define WXIMPORT _Export
59 # endif
60 #elif defined(__WXMAC__) || defined(__WXCOCOA__)
61 # ifdef __MWERKS__
62 # define WXEXPORT __declspec(export)
63 # define WXIMPORT __declspec(import)
64 # endif
65 #elif defined(__CYGWIN__)
66 # define WXEXPORT __declspec(dllexport)
67 # define WXIMPORT __declspec(dllimport)
68 #endif
69
70 /* for other platforms/compilers we don't anything */
71 #ifndef WXEXPORT
72 # define WXEXPORT
73 # define WXIMPORT
74 #endif
75
76 /*
77 We support building wxWidgets as a set of several libraries but we don't
78 support arbitrary combinations of libs/DLLs: either we build all of them as
79 DLLs (in which case WXMAKINGDLL is defined) or none (it isn't).
80
81 However we have a problem because we need separate WXDLLIMPEXP versions for
82 different libraries as, for example, wxString class should be dllexported
83 when compiled in wxBase and dllimported otherwise, so we do define separate
84 WXMAKING/USINGDLL_XYZ constants for each component XYZ.
85 */
86 #ifdef WXMAKINGDLL
87 # if wxUSE_BASE
88 # define WXMAKINGDLL_BASE
89 # endif
90
91 # define WXMAKINGDLL_NET
92 # define WXMAKINGDLL_CORE
93 # define WXMAKINGDLL_ADV
94 # define WXMAKINGDLL_QA
95 # define WXMAKINGDLL_HTML
96 # define WXMAKINGDLL_GL
97 # define WXMAKINGDLL_XML
98 # define WXMAKINGDLL_XRC
99 # define WXMAKINGDLL_AUI
100 # define WXMAKINGDLL_RIBBON
101 # define WXMAKINGDLL_PROPGRID
102 # define WXMAKINGDLL_RICHTEXT
103 # define WXMAKINGDLL_MEDIA
104 # define WXMAKINGDLL_STC
105 # define WXMAKINGDLL_WEBVIEW
106 #endif /* WXMAKINGDLL */
107
108 /*
109 WXDLLIMPEXP_CORE maps to export declaration when building the DLL, to import
110 declaration if using it or to nothing at all if we don't use wxWin as DLL
111 */
112 #ifdef WXMAKINGDLL_BASE
113 # define WXDLLIMPEXP_BASE WXEXPORT
114 # define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type
115 # if defined(HAVE_VISIBILITY)
116 # define WXDLLIMPEXP_INLINE_BASE WXEXPORT
117 # else
118 # define WXDLLIMPEXP_INLINE_BASE
119 # endif
120 #elif defined(WXUSINGDLL)
121 # define WXDLLIMPEXP_BASE WXIMPORT
122 # define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type
123 # if defined(HAVE_VISIBILITY)
124 # define WXDLLIMPEXP_INLINE_BASE WXIMPORT
125 # else
126 # define WXDLLIMPEXP_INLINE_BASE
127 # endif
128 #else /* not making nor using DLL */
129 # define WXDLLIMPEXP_BASE
130 # define WXDLLIMPEXP_DATA_BASE(type) type
131 # define WXDLLIMPEXP_INLINE_BASE
132 #endif
133
134 #ifdef WXMAKINGDLL_NET
135 # define WXDLLIMPEXP_NET WXEXPORT
136 # define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type
137 #elif defined(WXUSINGDLL)
138 # define WXDLLIMPEXP_NET WXIMPORT
139 # define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type
140 #else /* not making nor using DLL */
141 # define WXDLLIMPEXP_NET
142 # define WXDLLIMPEXP_DATA_NET(type) type
143 #endif
144
145 #ifdef WXMAKINGDLL_CORE
146 # define WXDLLIMPEXP_CORE WXEXPORT
147 # define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type
148 # if defined(HAVE_VISIBILITY)
149 # define WXDLLIMPEXP_INLINE_CORE WXEXPORT
150 # else
151 # define WXDLLIMPEXP_INLINE_CORE
152 # endif
153 #elif defined(WXUSINGDLL)
154 # define WXDLLIMPEXP_CORE WXIMPORT
155 # define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type
156 # if defined(HAVE_VISIBILITY)
157 # define WXDLLIMPEXP_INLINE_CORE WXIMPORT
158 # else
159 # define WXDLLIMPEXP_INLINE_CORE
160 # endif
161 #else /* not making nor using DLL */
162 # define WXDLLIMPEXP_CORE
163 # define WXDLLIMPEXP_DATA_CORE(type) type
164 # define WXDLLIMPEXP_INLINE_CORE
165 #endif
166
167 #ifdef WXMAKINGDLL_ADV
168 # define WXDLLIMPEXP_ADV WXEXPORT
169 # define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type
170 #elif defined(WXUSINGDLL)
171 # define WXDLLIMPEXP_ADV WXIMPORT
172 # define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type
173 #else /* not making nor using DLL */
174 # define WXDLLIMPEXP_ADV
175 # define WXDLLIMPEXP_DATA_ADV(type) type
176 #endif
177
178 #ifdef WXMAKINGDLL_QA
179 # define WXDLLIMPEXP_QA WXEXPORT
180 # define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type
181 #elif defined(WXUSINGDLL)
182 # define WXDLLIMPEXP_QA WXIMPORT
183 # define WXDLLIMPEXP_DATA_QA(type) WXIMPORT type
184 #else /* not making nor using DLL */
185 # define WXDLLIMPEXP_QA
186 # define WXDLLIMPEXP_DATA_QA(type) type
187 #endif
188
189 #ifdef WXMAKINGDLL_HTML
190 # define WXDLLIMPEXP_HTML WXEXPORT
191 # define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type
192 #elif defined(WXUSINGDLL)
193 # define WXDLLIMPEXP_HTML WXIMPORT
194 # define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type
195 #else /* not making nor using DLL */
196 # define WXDLLIMPEXP_HTML
197 # define WXDLLIMPEXP_DATA_HTML(type) type
198 #endif
199
200 #ifdef WXMAKINGDLL_GL
201 # define WXDLLIMPEXP_GL WXEXPORT
202 #elif defined(WXUSINGDLL)
203 # define WXDLLIMPEXP_GL WXIMPORT
204 #else /* not making nor using DLL */
205 # define WXDLLIMPEXP_GL
206 #endif
207
208 #ifdef WXMAKINGDLL_XML
209 # define WXDLLIMPEXP_XML WXEXPORT
210 #elif defined(WXUSINGDLL)
211 # define WXDLLIMPEXP_XML WXIMPORT
212 #else /* not making nor using DLL */
213 # define WXDLLIMPEXP_XML
214 #endif
215
216 #ifdef WXMAKINGDLL_XRC
217 # define WXDLLIMPEXP_XRC WXEXPORT
218 #elif defined(WXUSINGDLL)
219 # define WXDLLIMPEXP_XRC WXIMPORT
220 #else /* not making nor using DLL */
221 # define WXDLLIMPEXP_XRC
222 #endif
223
224 #ifdef WXMAKINGDLL_AUI
225 # define WXDLLIMPEXP_AUI WXEXPORT
226 #elif defined(WXUSINGDLL)
227 # define WXDLLIMPEXP_AUI WXIMPORT
228 #else /* not making nor using DLL */
229 # define WXDLLIMPEXP_AUI
230 #endif
231
232 #ifdef WXMAKINGDLL_RIBBON
233 # define WXDLLIMPEXP_RIBBON WXEXPORT
234 #elif defined(WXUSINGDLL)
235 # define WXDLLIMPEXP_RIBBON WXIMPORT
236 #else /* not making nor using DLL */
237 # define WXDLLIMPEXP_RIBBON
238 #endif
239
240 #ifdef WXMAKINGDLL_PROPGRID
241 # define WXDLLIMPEXP_PROPGRID WXEXPORT
242 # define WXDLLIMPEXP_DATA_PROPGRID(type) WXEXPORT type
243 #elif defined(WXUSINGDLL)
244 # define WXDLLIMPEXP_PROPGRID WXIMPORT
245 # define WXDLLIMPEXP_DATA_PROPGRID(type) WXIMPORT type
246 #else /* not making nor using DLL */
247 # define WXDLLIMPEXP_PROPGRID
248 # define WXDLLIMPEXP_DATA_PROPGRID(type) type
249 #endif
250
251 #ifdef WXMAKINGDLL_RICHTEXT
252 # define WXDLLIMPEXP_RICHTEXT WXEXPORT
253 #elif defined(WXUSINGDLL)
254 # define WXDLLIMPEXP_RICHTEXT WXIMPORT
255 #else /* not making nor using DLL */
256 # define WXDLLIMPEXP_RICHTEXT
257 #endif
258
259 #ifdef WXMAKINGDLL_MEDIA
260 # define WXDLLIMPEXP_MEDIA WXEXPORT
261 #elif defined(WXUSINGDLL)
262 # define WXDLLIMPEXP_MEDIA WXIMPORT
263 #else /* not making nor using DLL */
264 # define WXDLLIMPEXP_MEDIA
265 #endif
266
267 #ifdef WXMAKINGDLL_STC
268 # define WXDLLIMPEXP_STC WXEXPORT
269 # define WXDLLIMPEXP_DATA_STC(type) WXEXPORT type
270 #elif defined(WXUSINGDLL)
271 # define WXDLLIMPEXP_STC WXIMPORT
272 # define WXDLLIMPEXP_DATA_STC(type) WXIMPORT type
273 #else /* not making nor using DLL */
274 # define WXDLLIMPEXP_STC
275 # define WXDLLIMPEXP_DATA_STC(type) type
276 #endif
277
278 #ifdef WXMAKINGDLL_WEBVIEW
279 # define WXDLLIMPEXP_WEBVIEW WXEXPORT
280 # define WXDLLIMPEXP_DATA_WEBVIEW(type) WXEXPORT type
281 #elif defined(WXUSINGDLL)
282 # define WXDLLIMPEXP_WEBVIEW WXIMPORT
283 # define WXDLLIMPEXP_DATA_WEBVIEW(type) WXIMPORT type
284 #else /* not making nor using DLL */
285 # define WXDLLIMPEXP_WEBVIEW
286 # define WXDLLIMPEXP_DATA_WEBVIEW(type) type
287 #endif
288
289 /*
290 GCC warns about using __attribute__ (and also __declspec in mingw32 case) on
291 forward declarations while MSVC complains about forward declarations without
292 __declspec for the classes later declared with it, so we need a separate set
293 of macros for forward declarations to hide this difference:
294 */
295 #if defined(HAVE_VISIBILITY) || (defined(__WINDOWS__) && defined(__GNUC__))
296 #define WXDLLIMPEXP_FWD_BASE
297 #define WXDLLIMPEXP_FWD_NET
298 #define WXDLLIMPEXP_FWD_CORE
299 #define WXDLLIMPEXP_FWD_ADV
300 #define WXDLLIMPEXP_FWD_QA
301 #define WXDLLIMPEXP_FWD_HTML
302 #define WXDLLIMPEXP_FWD_GL
303 #define WXDLLIMPEXP_FWD_XML
304 #define WXDLLIMPEXP_FWD_XRC
305 #define WXDLLIMPEXP_FWD_AUI
306 #define WXDLLIMPEXP_FWD_PROPGRID
307 #define WXDLLIMPEXP_FWD_RICHTEXT
308 #define WXDLLIMPEXP_FWD_MEDIA
309 #define WXDLLIMPEXP_FWD_STC
310 #define WXDLLIMPEXP_FWD_WEBVIEW
311 #else
312 #define WXDLLIMPEXP_FWD_BASE WXDLLIMPEXP_BASE
313 #define WXDLLIMPEXP_FWD_NET WXDLLIMPEXP_NET
314 #define WXDLLIMPEXP_FWD_CORE WXDLLIMPEXP_CORE
315 #define WXDLLIMPEXP_FWD_ADV WXDLLIMPEXP_ADV
316 #define WXDLLIMPEXP_FWD_QA WXDLLIMPEXP_QA
317 #define WXDLLIMPEXP_FWD_HTML WXDLLIMPEXP_HTML
318 #define WXDLLIMPEXP_FWD_GL WXDLLIMPEXP_GL
319 #define WXDLLIMPEXP_FWD_XML WXDLLIMPEXP_XML
320 #define WXDLLIMPEXP_FWD_XRC WXDLLIMPEXP_XRC
321 #define WXDLLIMPEXP_FWD_AUI WXDLLIMPEXP_AUI
322 #define WXDLLIMPEXP_FWD_PROPGRID WXDLLIMPEXP_PROPGRID
323 #define WXDLLIMPEXP_FWD_RICHTEXT WXDLLIMPEXP_RICHTEXT
324 #define WXDLLIMPEXP_FWD_MEDIA WXDLLIMPEXP_MEDIA
325 #define WXDLLIMPEXP_FWD_STC WXDLLIMPEXP_STC
326 #define WXDLLIMPEXP_FWD_WEBVIEW WXDLLIMPEXP_WEBVIEW
327 #endif
328
329 /* for backwards compatibility, define suffix-less versions too */
330 #define WXDLLEXPORT WXDLLIMPEXP_CORE
331 #define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE
332
333 /*
334 MSVC up to 6.0 needs to be explicitly told to export template instantiations
335 used by the DLL clients, use this macro to do it like this:
336
337 template <typename T> class Foo { ... };
338 WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( Foo<int> )
339
340 (notice that currently we only need this for wxBase and wxCore libraries)
341 */
342 #if defined(__VISUALC__) && (__VISUALC__ <= 1200)
343 #ifdef WXMAKINGDLL_BASE
344 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) \
345 template class WXDLLIMPEXP_BASE decl;
346 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) \
347 template class WXDLLIMPEXP_CORE decl;
348 #else
349 /*
350 We need to disable this warning when using this macro, as
351 recommended by Microsoft itself:
352
353 http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b168958
354 */
355 #pragma warning(disable:4231)
356
357 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) \
358 extern template class WXDLLIMPEXP_BASE decl;
359 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) \
360 extern template class WXDLLIMPEXP_CORE decl;
361 #endif
362 #else /* not VC <= 6 */
363 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl)
364 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl)
365 #endif /* VC6/others */
366
367 #endif /* _WX_DLIMPEXP_H_ */
368