]>
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 | ||
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 | |
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) | |
0cc66b6c VZ |
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 | /* | |
77ffb593 | 63 | We support building wxWidgets as a set of several libraries but we don't |
0cc66b6c VZ |
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_ODBC | |
81 | # define WXMAKINGDLL_DBGRID | |
82 | # define WXMAKINGDLL_HTML | |
0ae4d121 | 83 | # define WXMAKINGDLL_GL |
0cc66b6c | 84 | # define WXMAKINGDLL_XML |
c846884b | 85 | # define WXMAKINGDLL_XRC |
5e4903f5 | 86 | # define WXMAKINGDLL_AUI |
c220a8ec | 87 | # define WXMAKINGDLL_MEDIA |
0cc66b6c VZ |
88 | #endif /* WXMAKINGDLL */ |
89 | ||
90 | /* | |
91 | WXDLLEXPORT maps to export declaration when building the DLL, to import | |
92 | declaration if using it or to nothing at all if we don't use wxWin as DLL | |
93 | */ | |
94 | #ifdef WXMAKINGDLL_BASE | |
95 | # define WXDLLIMPEXP_BASE WXEXPORT | |
96 | # define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type | |
97 | #elif defined(WXUSINGDLL) | |
98 | # define WXDLLIMPEXP_BASE WXIMPORT | |
99 | # define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type | |
100 | #else /* not making nor using DLL */ | |
101 | # define WXDLLIMPEXP_BASE | |
102 | # define WXDLLIMPEXP_DATA_BASE(type) type | |
103 | #endif | |
104 | ||
105 | #ifdef WXMAKINGDLL_NET | |
106 | # define WXDLLIMPEXP_NET WXEXPORT | |
107 | # define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type | |
108 | #elif defined(WXUSINGDLL) | |
109 | # define WXDLLIMPEXP_NET WXIMPORT | |
110 | # define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type | |
111 | #else /* not making nor using DLL */ | |
112 | # define WXDLLIMPEXP_NET | |
113 | # define WXDLLIMPEXP_DATA_NET(type) type | |
114 | #endif | |
115 | ||
116 | #ifdef WXMAKINGDLL_CORE | |
117 | # define WXDLLIMPEXP_CORE WXEXPORT | |
118 | # define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type | |
119 | #elif defined(WXUSINGDLL) | |
120 | # define WXDLLIMPEXP_CORE WXIMPORT | |
121 | # define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type | |
122 | #else /* not making nor using DLL */ | |
123 | # define WXDLLIMPEXP_CORE | |
124 | # define WXDLLIMPEXP_DATA_CORE(type) type | |
125 | #endif | |
126 | ||
127 | #ifdef WXMAKINGDLL_ADV | |
128 | # define WXDLLIMPEXP_ADV WXEXPORT | |
129 | # define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type | |
130 | #elif defined(WXUSINGDLL) | |
131 | # define WXDLLIMPEXP_ADV WXIMPORT | |
132 | # define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type | |
133 | #else /* not making nor using DLL */ | |
134 | # define WXDLLIMPEXP_ADV | |
135 | # define WXDLLIMPEXP_DATA_ADV(type) type | |
136 | #endif | |
137 | ||
138 | #ifdef WXMAKINGDLL_ODBC | |
139 | # define WXDLLIMPEXP_ODBC WXEXPORT | |
140 | # define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type | |
141 | #elif defined(WXUSINGDLL) | |
142 | # define WXDLLIMPEXP_ODBC WXIMPORT | |
143 | # define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type | |
144 | #else /* not making nor using DLL */ | |
145 | # define WXDLLIMPEXP_ODBC | |
146 | # define WXDLLIMPEXP_DATA_ODBC(type) type | |
147 | #endif | |
148 | ||
61639efb VZ |
149 | #ifdef WXMAKINGDLL_QA |
150 | # define WXDLLIMPEXP_QA WXEXPORT | |
151 | # define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type | |
152 | #elif defined(WXUSINGDLL) | |
153 | # define WXDLLIMPEXP_QA WXIMPORT | |
154 | # define WXDLLIMPEXP_DATA_QA(type) WXIMPORT type | |
155 | #else /* not making nor using DLL */ | |
156 | # define WXDLLIMPEXP_QA | |
157 | # define WXDLLIMPEXP_DATA_QA(type) type | |
158 | #endif | |
159 | ||
0cc66b6c VZ |
160 | #ifdef WXMAKINGDLL_DBGRID |
161 | # define WXDLLIMPEXP_DBGRID WXEXPORT | |
162 | # define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type | |
163 | #elif defined(WXUSINGDLL) | |
164 | # define WXDLLIMPEXP_DBGRID WXIMPORT | |
165 | # define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type | |
166 | #else /* not making nor using DLL */ | |
167 | # define WXDLLIMPEXP_DBGRID | |
168 | # define WXDLLIMPEXP_DATA_DBGRID(type) type | |
169 | #endif | |
170 | ||
171 | #ifdef WXMAKINGDLL_HTML | |
172 | # define WXDLLIMPEXP_HTML WXEXPORT | |
173 | # define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type | |
174 | #elif defined(WXUSINGDLL) | |
175 | # define WXDLLIMPEXP_HTML WXIMPORT | |
176 | # define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type | |
177 | #else /* not making nor using DLL */ | |
178 | # define WXDLLIMPEXP_HTML | |
179 | # define WXDLLIMPEXP_DATA_HTML(type) type | |
180 | #endif | |
181 | ||
182 | #ifdef WXMAKINGDLL_GL | |
183 | # define WXDLLIMPEXP_GL WXEXPORT | |
184 | #elif defined(WXUSINGDLL) | |
185 | # define WXDLLIMPEXP_GL WXIMPORT | |
186 | #else /* not making nor using DLL */ | |
187 | # define WXDLLIMPEXP_GL | |
188 | #endif | |
189 | ||
190 | #ifdef WXMAKINGDLL_XML | |
191 | # define WXDLLIMPEXP_XML WXEXPORT | |
192 | #elif defined(WXUSINGDLL) | |
193 | # define WXDLLIMPEXP_XML WXIMPORT | |
194 | #else /* not making nor using DLL */ | |
195 | # define WXDLLIMPEXP_XML | |
196 | #endif | |
197 | ||
c846884b RD |
198 | #ifdef WXMAKINGDLL_XRC |
199 | # define WXDLLIMPEXP_XRC WXEXPORT | |
200 | #elif defined(WXUSINGDLL) | |
201 | # define WXDLLIMPEXP_XRC WXIMPORT | |
202 | #else /* not making nor using DLL */ | |
203 | # define WXDLLIMPEXP_XRC | |
204 | #endif | |
205 | ||
5e4903f5 JS |
206 | #ifdef WXMAKINGDLL_AUI |
207 | # define WXDLLIMPEXP_AUI WXEXPORT | |
208 | #elif defined(WXUSINGDLL) | |
209 | # define WXDLLIMPEXP_AUI WXIMPORT | |
210 | #else /* not making nor using DLL */ | |
211 | # define WXDLLIMPEXP_AUI | |
212 | #endif | |
213 | ||
ff2b312f RN |
214 | #ifdef WXMAKINGDLL_MEDIA |
215 | # define WXDLLIMPEXP_MEDIA WXEXPORT | |
216 | #elif defined(WXUSINGDLL) | |
217 | # define WXDLLIMPEXP_MEDIA WXIMPORT | |
218 | #else /* not making nor using DLL */ | |
219 | # define WXDLLIMPEXP_MEDIA | |
220 | #endif | |
221 | ||
0cc66b6c VZ |
222 | /* for backwards compatibility, define suffix-less versions too */ |
223 | #define WXDLLEXPORT WXDLLIMPEXP_CORE | |
224 | #define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE | |
225 | ||
226 | #endif /* _WX_DLIMPEXP_H_ */ | |
227 |