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