]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dlimpexp.h
fix Watcom compilation: removed templates for wxFileSelector() compatibility with...
[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(__WXMSW__)
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
39 # elif defined(__EMX__)
40 # define WXEXPORT
41 # define WXIMPORT
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
51 #elif defined(__CYGWIN__)
52 # define WXEXPORT __declspec(dllexport)
53 # define WXIMPORT __declspec(dllimport)
54 #endif
55
56 /* for other platforms/compilers we don't anything */
57 #ifndef WXEXPORT
58 # define WXEXPORT
59 # define WXIMPORT
60 #endif
61
62 /*
63 We support building wxWidgets as a set of several libraries but we don't
64 support arbitrary combinations of libs/DLLs: either we build all of them as
65 DLLs (in which case WXMAKINGDLL is defined) or none (it isn't).
66
67 However we have a problem because we need separate WXDLLEXPORT versions for
68 different libraries as, for example, wxString class should be dllexported
69 when compiled in wxBase and dllimported otherwise, so we do define separate
70 WXMAKING/USINGDLL_XYZ constants for each component XYZ.
71 */
72 #ifdef WXMAKINGDLL
73 # if wxUSE_BASE
74 # define WXMAKINGDLL_BASE
75 # endif
76
77 # define WXMAKINGDLL_NET
78 # define WXMAKINGDLL_CORE
79 # define WXMAKINGDLL_ADV
80 # define WXMAKINGDLL_QA
81 # define WXMAKINGDLL_ODBC
82 # define WXMAKINGDLL_DBGRID
83 # define WXMAKINGDLL_HTML
84 # define WXMAKINGDLL_GL
85 # define WXMAKINGDLL_XML
86 # define WXMAKINGDLL_XRC
87 # define WXMAKINGDLL_AUI
88 # define WXMAKINGDLL_RICHTEXT
89 # define WXMAKINGDLL_MEDIA
90 # define WXMAKINGDLL_STC
91 #endif /* WXMAKINGDLL */
92
93 /*
94 WXDLLEXPORT maps to export declaration when building the DLL, to import
95 declaration if using it or to nothing at all if we don't use wxWin as DLL
96 */
97 #ifdef WXMAKINGDLL_BASE
98 # define WXDLLIMPEXP_BASE WXEXPORT
99 # define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type
100 #elif defined(WXUSINGDLL)
101 # define WXDLLIMPEXP_BASE WXIMPORT
102 # define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type
103 #else /* not making nor using DLL */
104 # define WXDLLIMPEXP_BASE
105 # define WXDLLIMPEXP_DATA_BASE(type) type
106 #endif
107
108 #ifdef WXMAKINGDLL_NET
109 # define WXDLLIMPEXP_NET WXEXPORT
110 # define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type
111 #elif defined(WXUSINGDLL)
112 # define WXDLLIMPEXP_NET WXIMPORT
113 # define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type
114 #else /* not making nor using DLL */
115 # define WXDLLIMPEXP_NET
116 # define WXDLLIMPEXP_DATA_NET(type) type
117 #endif
118
119 #ifdef WXMAKINGDLL_CORE
120 # define WXDLLIMPEXP_CORE WXEXPORT
121 # define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type
122 #elif defined(WXUSINGDLL)
123 # define WXDLLIMPEXP_CORE WXIMPORT
124 # define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type
125 #else /* not making nor using DLL */
126 # define WXDLLIMPEXP_CORE
127 # define WXDLLIMPEXP_DATA_CORE(type) type
128 #endif
129
130 #ifdef WXMAKINGDLL_ADV
131 # define WXDLLIMPEXP_ADV WXEXPORT
132 # define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type
133 #elif defined(WXUSINGDLL)
134 # define WXDLLIMPEXP_ADV WXIMPORT
135 # define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type
136 #else /* not making nor using DLL */
137 # define WXDLLIMPEXP_ADV
138 # define WXDLLIMPEXP_DATA_ADV(type) type
139 #endif
140
141 #ifdef WXMAKINGDLL_ODBC
142 # define WXDLLIMPEXP_ODBC WXEXPORT
143 # define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type
144 #elif defined(WXUSINGDLL)
145 # define WXDLLIMPEXP_ODBC WXIMPORT
146 # define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type
147 #else /* not making nor using DLL */
148 # define WXDLLIMPEXP_ODBC
149 # define WXDLLIMPEXP_DATA_ODBC(type) type
150 #endif
151
152 #ifdef WXMAKINGDLL_QA
153 # define WXDLLIMPEXP_QA WXEXPORT
154 # define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type
155 #elif defined(WXUSINGDLL)
156 # define WXDLLIMPEXP_QA WXIMPORT
157 # define WXDLLIMPEXP_DATA_QA(type) WXIMPORT type
158 #else /* not making nor using DLL */
159 # define WXDLLIMPEXP_QA
160 # define WXDLLIMPEXP_DATA_QA(type) type
161 #endif
162
163 #ifdef WXMAKINGDLL_DBGRID
164 # define WXDLLIMPEXP_DBGRID WXEXPORT
165 # define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type
166 #elif defined(WXUSINGDLL)
167 # define WXDLLIMPEXP_DBGRID WXIMPORT
168 # define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type
169 #else /* not making nor using DLL */
170 # define WXDLLIMPEXP_DBGRID
171 # define WXDLLIMPEXP_DATA_DBGRID(type) type
172 #endif
173
174 #ifdef WXMAKINGDLL_HTML
175 # define WXDLLIMPEXP_HTML WXEXPORT
176 # define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type
177 #elif defined(WXUSINGDLL)
178 # define WXDLLIMPEXP_HTML WXIMPORT
179 # define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type
180 #else /* not making nor using DLL */
181 # define WXDLLIMPEXP_HTML
182 # define WXDLLIMPEXP_DATA_HTML(type) type
183 #endif
184
185 #ifdef WXMAKINGDLL_GL
186 # define WXDLLIMPEXP_GL WXEXPORT
187 #elif defined(WXUSINGDLL)
188 # define WXDLLIMPEXP_GL WXIMPORT
189 #else /* not making nor using DLL */
190 # define WXDLLIMPEXP_GL
191 #endif
192
193 #ifdef WXMAKINGDLL_XML
194 # define WXDLLIMPEXP_XML WXEXPORT
195 #elif defined(WXUSINGDLL)
196 # define WXDLLIMPEXP_XML WXIMPORT
197 #else /* not making nor using DLL */
198 # define WXDLLIMPEXP_XML
199 #endif
200
201 #ifdef WXMAKINGDLL_XRC
202 # define WXDLLIMPEXP_XRC WXEXPORT
203 #elif defined(WXUSINGDLL)
204 # define WXDLLIMPEXP_XRC WXIMPORT
205 #else /* not making nor using DLL */
206 # define WXDLLIMPEXP_XRC
207 #endif
208
209 #ifdef WXMAKINGDLL_AUI
210 # define WXDLLIMPEXP_AUI WXEXPORT
211 #elif defined(WXUSINGDLL)
212 # define WXDLLIMPEXP_AUI WXIMPORT
213 #else /* not making nor using DLL */
214 # define WXDLLIMPEXP_AUI
215 #endif
216
217 #ifdef WXMAKINGDLL_RICHTEXT
218 # define WXDLLIMPEXP_RICHTEXT WXEXPORT
219 #elif defined(WXUSINGDLL)
220 # define WXDLLIMPEXP_RICHTEXT WXIMPORT
221 #else /* not making nor using DLL */
222 # define WXDLLIMPEXP_RICHTEXT
223 #endif
224
225 #ifdef WXMAKINGDLL_MEDIA
226 # define WXDLLIMPEXP_MEDIA WXEXPORT
227 #elif defined(WXUSINGDLL)
228 # define WXDLLIMPEXP_MEDIA WXIMPORT
229 #else /* not making nor using DLL */
230 # define WXDLLIMPEXP_MEDIA
231 #endif
232
233 #ifdef WXMAKINGDLL_STC
234 #define WXDLLIMPEXP_STC WXEXPORT
235 #elif defined(WXUSINGDLL)
236 #define WXDLLIMPEXP_STC WXIMPORT
237 #else /* not making nor using DLL */
238 #define WXDLLIMPEXP_STC
239 #endif
240
241 /* for backwards compatibility, define suffix-less versions too */
242 #define WXDLLEXPORT WXDLLIMPEXP_CORE
243 #define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE
244
245 #endif /* _WX_DLIMPEXP_H_ */
246