]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dlimpexp.h
Refactor wxDocParentFrame and wxDocMDIParentFrame to share common base class.
[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
25 as VC++ and gcc
26 */
27# if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) || defined(__WATCOMC__)
28# define WXEXPORT __declspec(dllexport)
29# define WXIMPORT __declspec(dllimport)
30# else /* compiler doesn't support __declspec() */
31# define WXEXPORT
32# define WXIMPORT
33# endif
34#elif defined(__WXPM__)
35# if defined (__WATCOMC__)
36# define WXEXPORT __declspec(dllexport)
37 /*
38 __declspec(dllimport) prepends __imp to imported symbols. We do NOT
39 want that!
40 */
41# define WXIMPORT
fd928524
DW
42# elif defined(__EMX__)
43# define WXEXPORT
44# define WXIMPORT
0cc66b6c
VZ
45# elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
46# define WXEXPORT _Export
47# define WXIMPORT _Export
48# endif
49#elif defined(__WXMAC__) || defined(__WXCOCOA__)
50# ifdef __MWERKS__
51# define WXEXPORT __declspec(export)
52# define WXIMPORT __declspec(import)
53# endif
7275146d
MW
54#elif defined(__CYGWIN__)
55# define WXEXPORT __declspec(dllexport)
56# define WXIMPORT __declspec(dllimport)
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
53a2db12 70 However we have a problem because we need separate WXDLLIMPEXP versions for
0cc66b6c
VZ
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 84# define WXMAKINGDLL_HTML
0ae4d121 85# define WXMAKINGDLL_GL
0cc66b6c 86# define WXMAKINGDLL_XML
c846884b 87# define WXMAKINGDLL_XRC
5e4903f5 88# define WXMAKINGDLL_AUI
3c3ead1d 89# define WXMAKINGDLL_RIBBON
d4cd6b3e 90# define WXMAKINGDLL_PROPGRID
3b2cb431 91# define WXMAKINGDLL_RICHTEXT
c220a8ec 92# define WXMAKINGDLL_MEDIA
c079af66 93# define WXMAKINGDLL_STC
0cc66b6c
VZ
94#endif /* WXMAKINGDLL */
95
96/*
53a2db12 97 WXDLLIMPEXP_CORE maps to export declaration when building the DLL, to import
0cc66b6c
VZ
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
5f9c3802
SC
103# if defined(HAVE_VISIBILITY)
104# define WXDLLIMPEXP_INLINE_BASE WXEXPORT
105# else
106# define WXDLLIMPEXP_INLINE_BASE
107# endif
0cc66b6c
VZ
108#elif defined(WXUSINGDLL)
109# define WXDLLIMPEXP_BASE WXIMPORT
110# define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type
5f9c3802
SC
111# if defined(HAVE_VISIBILITY)
112# define WXDLLIMPEXP_INLINE_BASE WXIMPORT
113# else
114# define WXDLLIMPEXP_INLINE_BASE
115# endif
0cc66b6c
VZ
116#else /* not making nor using DLL */
117# define WXDLLIMPEXP_BASE
118# define WXDLLIMPEXP_DATA_BASE(type) type
5f9c3802 119# define WXDLLIMPEXP_INLINE_BASE
0cc66b6c
VZ
120#endif
121
122#ifdef WXMAKINGDLL_NET
123# define WXDLLIMPEXP_NET WXEXPORT
124# define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type
125#elif defined(WXUSINGDLL)
126# define WXDLLIMPEXP_NET WXIMPORT
127# define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type
128#else /* not making nor using DLL */
129# define WXDLLIMPEXP_NET
130# define WXDLLIMPEXP_DATA_NET(type) type
131#endif
132
133#ifdef WXMAKINGDLL_CORE
134# define WXDLLIMPEXP_CORE WXEXPORT
135# define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type
74cc3ec1
SC
136# if defined(HAVE_VISIBILITY)
137# define WXDLLIMPEXP_INLINE_CORE WXEXPORT
138# else
139# define WXDLLIMPEXP_INLINE_CORE
140# endif
0cc66b6c
VZ
141#elif defined(WXUSINGDLL)
142# define WXDLLIMPEXP_CORE WXIMPORT
143# define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type
74cc3ec1
SC
144# if defined(HAVE_VISIBILITY)
145# define WXDLLIMPEXP_INLINE_CORE WXIMPORT
146# else
147# define WXDLLIMPEXP_INLINE_CORE
148# endif
0cc66b6c
VZ
149#else /* not making nor using DLL */
150# define WXDLLIMPEXP_CORE
151# define WXDLLIMPEXP_DATA_CORE(type) type
74cc3ec1 152# define WXDLLIMPEXP_INLINE_CORE
0cc66b6c
VZ
153#endif
154
155#ifdef WXMAKINGDLL_ADV
156# define WXDLLIMPEXP_ADV WXEXPORT
157# define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type
158#elif defined(WXUSINGDLL)
159# define WXDLLIMPEXP_ADV WXIMPORT
160# define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type
161#else /* not making nor using DLL */
162# define WXDLLIMPEXP_ADV
163# define WXDLLIMPEXP_DATA_ADV(type) type
164#endif
165
61639efb
VZ
166#ifdef WXMAKINGDLL_QA
167# define WXDLLIMPEXP_QA WXEXPORT
168# define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type
169#elif defined(WXUSINGDLL)
170# define WXDLLIMPEXP_QA WXIMPORT
171# define WXDLLIMPEXP_DATA_QA(type) WXIMPORT type
172#else /* not making nor using DLL */
173# define WXDLLIMPEXP_QA
174# define WXDLLIMPEXP_DATA_QA(type) type
175#endif
176
0cc66b6c
VZ
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
3c3ead1d
PC
220#ifdef WXMAKINGDLL_RIBBON
221# define WXDLLIMPEXP_RIBBON WXEXPORT
222#elif defined(WXUSINGDLL)
223# define WXDLLIMPEXP_RIBBON WXIMPORT
224#else /* not making nor using DLL */
225# define WXDLLIMPEXP_RIBBON
226#endif
227
1c4293cb
VZ
228#ifdef WXMAKINGDLL_PROPGRID
229# define WXDLLIMPEXP_PROPGRID WXEXPORT
23318a53 230# define WXDLLIMPEXP_DATA_PROPGRID(type) WXEXPORT type
1c4293cb
VZ
231#elif defined(WXUSINGDLL)
232# define WXDLLIMPEXP_PROPGRID WXIMPORT
23318a53 233# define WXDLLIMPEXP_DATA_PROPGRID(type) WXIMPORT type
1c4293cb
VZ
234#else /* not making nor using DLL */
235# define WXDLLIMPEXP_PROPGRID
23318a53 236# define WXDLLIMPEXP_DATA_PROPGRID(type) type
1c4293cb
VZ
237#endif
238
3b2cb431
JS
239#ifdef WXMAKINGDLL_RICHTEXT
240# define WXDLLIMPEXP_RICHTEXT WXEXPORT
241#elif defined(WXUSINGDLL)
242# define WXDLLIMPEXP_RICHTEXT WXIMPORT
243#else /* not making nor using DLL */
244# define WXDLLIMPEXP_RICHTEXT
245#endif
246
ff2b312f
RN
247#ifdef WXMAKINGDLL_MEDIA
248# define WXDLLIMPEXP_MEDIA WXEXPORT
249#elif defined(WXUSINGDLL)
250# define WXDLLIMPEXP_MEDIA WXIMPORT
251#else /* not making nor using DLL */
252# define WXDLLIMPEXP_MEDIA
253#endif
254
c079af66 255#ifdef WXMAKINGDLL_STC
23318a53
FM
256# define WXDLLIMPEXP_STC WXEXPORT
257# define WXDLLIMPEXP_DATA_STC(type) WXEXPORT type
c079af66 258#elif defined(WXUSINGDLL)
23318a53
FM
259# define WXDLLIMPEXP_STC WXIMPORT
260# define WXDLLIMPEXP_DATA_STC(type) WXIMPORT type
c079af66 261#else /* not making nor using DLL */
23318a53
FM
262# define WXDLLIMPEXP_STC
263# define WXDLLIMPEXP_DATA_STC(type) type
c079af66
VZ
264#endif
265
8ece1737
VZ
266/*
267 GCC warns about using __attribute__ (and also __declspec in mingw32 case) on
268 forward declarations while MSVC complains about forward declarations without
269 __declspec for the classes later declared with it, so we need a separate set
270 of macros for forward declarations to hide this difference:
271 */
272#if defined(HAVE_VISIBILITY) || (defined(__WINDOWS__) && defined(__GNUC__))
0ff20b9f
VS
273 #define WXDLLIMPEXP_FWD_BASE
274 #define WXDLLIMPEXP_FWD_NET
275 #define WXDLLIMPEXP_FWD_CORE
276 #define WXDLLIMPEXP_FWD_ADV
277 #define WXDLLIMPEXP_FWD_QA
0ff20b9f
VS
278 #define WXDLLIMPEXP_FWD_HTML
279 #define WXDLLIMPEXP_FWD_GL
280 #define WXDLLIMPEXP_FWD_XML
281 #define WXDLLIMPEXP_FWD_XRC
282 #define WXDLLIMPEXP_FWD_AUI
d4cd6b3e 283 #define WXDLLIMPEXP_FWD_PROPGRID
0ff20b9f
VS
284 #define WXDLLIMPEXP_FWD_RICHTEXT
285 #define WXDLLIMPEXP_FWD_MEDIA
286 #define WXDLLIMPEXP_FWD_STC
287#else
288 #define WXDLLIMPEXP_FWD_BASE WXDLLIMPEXP_BASE
289 #define WXDLLIMPEXP_FWD_NET WXDLLIMPEXP_NET
290 #define WXDLLIMPEXP_FWD_CORE WXDLLIMPEXP_CORE
291 #define WXDLLIMPEXP_FWD_ADV WXDLLIMPEXP_ADV
292 #define WXDLLIMPEXP_FWD_QA WXDLLIMPEXP_QA
0ff20b9f
VS
293 #define WXDLLIMPEXP_FWD_HTML WXDLLIMPEXP_HTML
294 #define WXDLLIMPEXP_FWD_GL WXDLLIMPEXP_GL
295 #define WXDLLIMPEXP_FWD_XML WXDLLIMPEXP_XML
296 #define WXDLLIMPEXP_FWD_XRC WXDLLIMPEXP_XRC
297 #define WXDLLIMPEXP_FWD_AUI WXDLLIMPEXP_AUI
d4cd6b3e 298 #define WXDLLIMPEXP_FWD_PROPGRID WXDLLIMPEXP_PROPGRID
0ff20b9f
VS
299 #define WXDLLIMPEXP_FWD_RICHTEXT WXDLLIMPEXP_RICHTEXT
300 #define WXDLLIMPEXP_FWD_MEDIA WXDLLIMPEXP_MEDIA
301 #define WXDLLIMPEXP_FWD_STC WXDLLIMPEXP_STC
302#endif
b5dbe15d 303
0cc66b6c
VZ
304/* for backwards compatibility, define suffix-less versions too */
305#define WXDLLEXPORT WXDLLIMPEXP_CORE
306#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE
307
7c77f334
VZ
308/*
309 MSVC up to 6.0 needs to be explicitly told to export template instantiations
310 used by the DLL clients, use this macro to do it like this:
311
312 template <typename T> class Foo { ... };
313 WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( Foo<int> )
314
16361ec9 315 (notice that currently we only need this for wxBase and wxCore libraries)
7c77f334
VZ
316 */
317#if defined(__VISUALC__) && (__VISUALC__ <= 1200)
318 #ifdef WXMAKINGDLL_BASE
319 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) \
320 template class WXDLLIMPEXP_BASE decl;
16361ec9
VS
321 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) \
322 template class WXDLLIMPEXP_CORE decl;
7c77f334
VZ
323 #else
324 /*
325 We need to disable this warning when using this macro, as
53a2db12 326 recommended by Microsoft itself:
7c77f334
VZ
327
328 http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b168958
329 */
330 #pragma warning(disable:4231)
331
332 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) \
333 extern template class WXDLLIMPEXP_BASE decl;
16361ec9
VS
334 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) \
335 extern template class WXDLLIMPEXP_CORE decl;
7c77f334
VZ
336 #endif
337#else /* not VC <= 6 */
338 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl)
16361ec9 339 #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl)
7c77f334
VZ
340#endif /* VC6/others */
341
0cc66b6c
VZ
342#endif /* _WX_DLIMPEXP_H_ */
343