]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/dlimpexp.h
3 * Purpose: Macros for declaring DLL-imported/exported functions
4 * Author: Vadim Zeitlin
6 * Created: 16.10.2003 (extracted from wx/defs.h)
8 * Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
9 * Licence: wxWindows licence
13 This is a C file, not C++ one, do not use C++ comments here!
16 #ifndef _WX_DLIMPEXP_H_
17 #define _WX_DLIMPEXP_H_
19 #if defined(__WXMSW__)
21 __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well
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() */
31 #elif defined(__WXPM__)
32 # if defined (__WATCOMC__)
33 # define WXEXPORT __declspec(dllexport)
35 __declspec(dllimport) prepends __imp to imported symbols. We do NOT
39 # elif defined(__EMX__)
42 # elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
43 # define WXEXPORT _Export
44 # define WXIMPORT _Export
46 #elif defined(__WXMAC__) || defined(__WXCOCOA__)
48 # define WXEXPORT __declspec(export)
49 # define WXIMPORT __declspec(import)
51 #elif defined(__CYGWIN__)
52 # define WXEXPORT __declspec(dllexport)
53 # define WXIMPORT __declspec(dllimport)
56 /* for other platforms/compilers we don't anything */
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).
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.
74 # define WXMAKINGDLL_BASE
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_MEDIA
89 #endif /* WXMAKINGDLL */
92 WXDLLEXPORT maps to export declaration when building the DLL, to import
93 declaration if using it or to nothing at all if we don't use wxWin as DLL
95 #ifdef WXMAKINGDLL_BASE
96 # define WXDLLIMPEXP_BASE WXEXPORT
97 # define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type
98 #elif defined(WXUSINGDLL)
99 # define WXDLLIMPEXP_BASE WXIMPORT
100 # define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type
101 #else /* not making nor using DLL */
102 # define WXDLLIMPEXP_BASE
103 # define WXDLLIMPEXP_DATA_BASE(type) type
106 #ifdef WXMAKINGDLL_NET
107 # define WXDLLIMPEXP_NET WXEXPORT
108 # define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type
109 #elif defined(WXUSINGDLL)
110 # define WXDLLIMPEXP_NET WXIMPORT
111 # define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type
112 #else /* not making nor using DLL */
113 # define WXDLLIMPEXP_NET
114 # define WXDLLIMPEXP_DATA_NET(type) type
117 #ifdef WXMAKINGDLL_CORE
118 # define WXDLLIMPEXP_CORE WXEXPORT
119 # define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type
120 #elif defined(WXUSINGDLL)
121 # define WXDLLIMPEXP_CORE WXIMPORT
122 # define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type
123 #else /* not making nor using DLL */
124 # define WXDLLIMPEXP_CORE
125 # define WXDLLIMPEXP_DATA_CORE(type) type
128 #ifdef WXMAKINGDLL_ADV
129 # define WXDLLIMPEXP_ADV WXEXPORT
130 # define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type
131 #elif defined(WXUSINGDLL)
132 # define WXDLLIMPEXP_ADV WXIMPORT
133 # define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type
134 #else /* not making nor using DLL */
135 # define WXDLLIMPEXP_ADV
136 # define WXDLLIMPEXP_DATA_ADV(type) type
139 #ifdef WXMAKINGDLL_ODBC
140 # define WXDLLIMPEXP_ODBC WXEXPORT
141 # define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type
142 #elif defined(WXUSINGDLL)
143 # define WXDLLIMPEXP_ODBC WXIMPORT
144 # define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type
145 #else /* not making nor using DLL */
146 # define WXDLLIMPEXP_ODBC
147 # define WXDLLIMPEXP_DATA_ODBC(type) type
150 #ifdef WXMAKINGDLL_QA
151 # define WXDLLIMPEXP_QA WXEXPORT
152 # define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type
153 #elif defined(WXUSINGDLL)
154 # define WXDLLIMPEXP_QA WXIMPORT
155 # define WXDLLIMPEXP_DATA_QA(type) WXIMPORT type
156 #else /* not making nor using DLL */
157 # define WXDLLIMPEXP_QA
158 # define WXDLLIMPEXP_DATA_QA(type) type
161 #ifdef WXMAKINGDLL_DBGRID
162 # define WXDLLIMPEXP_DBGRID WXEXPORT
163 # define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type
164 #elif defined(WXUSINGDLL)
165 # define WXDLLIMPEXP_DBGRID WXIMPORT
166 # define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type
167 #else /* not making nor using DLL */
168 # define WXDLLIMPEXP_DBGRID
169 # define WXDLLIMPEXP_DATA_DBGRID(type) type
172 #ifdef WXMAKINGDLL_HTML
173 # define WXDLLIMPEXP_HTML WXEXPORT
174 # define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type
175 #elif defined(WXUSINGDLL)
176 # define WXDLLIMPEXP_HTML WXIMPORT
177 # define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type
178 #else /* not making nor using DLL */
179 # define WXDLLIMPEXP_HTML
180 # define WXDLLIMPEXP_DATA_HTML(type) type
183 #ifdef WXMAKINGDLL_GL
184 # define WXDLLIMPEXP_GL WXEXPORT
185 #elif defined(WXUSINGDLL)
186 # define WXDLLIMPEXP_GL WXIMPORT
187 #else /* not making nor using DLL */
188 # define WXDLLIMPEXP_GL
191 #ifdef WXMAKINGDLL_XML
192 # define WXDLLIMPEXP_XML WXEXPORT
193 #elif defined(WXUSINGDLL)
194 # define WXDLLIMPEXP_XML WXIMPORT
195 #else /* not making nor using DLL */
196 # define WXDLLIMPEXP_XML
199 #ifdef WXMAKINGDLL_XRC
200 # define WXDLLIMPEXP_XRC WXEXPORT
201 #elif defined(WXUSINGDLL)
202 # define WXDLLIMPEXP_XRC WXIMPORT
203 #else /* not making nor using DLL */
204 # define WXDLLIMPEXP_XRC
207 #ifdef WXMAKINGDLL_AUI
208 # define WXDLLIMPEXP_AUI WXEXPORT
209 #elif defined(WXUSINGDLL)
210 # define WXDLLIMPEXP_AUI WXIMPORT
211 #else /* not making nor using DLL */
212 # define WXDLLIMPEXP_AUI
215 #ifdef WXMAKINGDLL_MEDIA
216 # define WXDLLIMPEXP_MEDIA WXEXPORT
217 #elif defined(WXUSINGDLL)
218 # define WXDLLIMPEXP_MEDIA WXIMPORT
219 #else /* not making nor using DLL */
220 # define WXDLLIMPEXP_MEDIA
223 /* for backwards compatibility, define suffix-less versions too */
224 #define WXDLLEXPORT WXDLLIMPEXP_CORE
225 #define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE
227 #endif /* _WX_DLIMPEXP_H_ */