]>
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)
53 /* for other platforms/compilers we don't anything */
60 We support building wxWidgets as a set of several libraries but we don't
61 support arbitrary combinations of libs/DLLs: either we build all of them as
62 DLLs (in which case WXMAKINGDLL is defined) or none (it isn't).
64 However we have a problem because we need separate WXDLLEXPORT versions for
65 different libraries as, for example, wxString class should be dllexported
66 when compiled in wxBase and dllimported otherwise, so we do define separate
67 WXMAKING/USINGDLL_XYZ constants for each component XYZ.
71 # define WXMAKINGDLL_BASE
74 # define WXMAKINGDLL_NET
75 # define WXMAKINGDLL_CORE
76 # define WXMAKINGDLL_ADV
77 # define WXMAKINGDLL_ODBC
78 # define WXMAKINGDLL_DBGRID
79 # define WXMAKINGDLL_HTML
80 # define WXMAKINGDLL_XML
81 #endif /* WXMAKINGDLL */
84 WXDLLEXPORT maps to export declaration when building the DLL, to import
85 declaration if using it or to nothing at all if we don't use wxWin as DLL
87 #ifdef WXMAKINGDLL_BASE
88 # define WXDLLIMPEXP_BASE WXEXPORT
89 # define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type
90 #elif defined(WXUSINGDLL)
91 # define WXDLLIMPEXP_BASE WXIMPORT
92 # define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type
93 #else /* not making nor using DLL */
94 # define WXDLLIMPEXP_BASE
95 # define WXDLLIMPEXP_DATA_BASE(type) type
98 #ifdef WXMAKINGDLL_NET
99 # define WXDLLIMPEXP_NET WXEXPORT
100 # define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type
101 #elif defined(WXUSINGDLL)
102 # define WXDLLIMPEXP_NET WXIMPORT
103 # define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type
104 #else /* not making nor using DLL */
105 # define WXDLLIMPEXP_NET
106 # define WXDLLIMPEXP_DATA_NET(type) type
109 #ifdef WXMAKINGDLL_CORE
110 # define WXDLLIMPEXP_CORE WXEXPORT
111 # define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type
112 #elif defined(WXUSINGDLL)
113 # define WXDLLIMPEXP_CORE WXIMPORT
114 # define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type
115 #else /* not making nor using DLL */
116 # define WXDLLIMPEXP_CORE
117 # define WXDLLIMPEXP_DATA_CORE(type) type
120 #ifdef WXMAKINGDLL_ADV
121 # define WXDLLIMPEXP_ADV WXEXPORT
122 # define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type
123 #elif defined(WXUSINGDLL)
124 # define WXDLLIMPEXP_ADV WXIMPORT
125 # define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type
126 #else /* not making nor using DLL */
127 # define WXDLLIMPEXP_ADV
128 # define WXDLLIMPEXP_DATA_ADV(type) type
131 #ifdef WXMAKINGDLL_ODBC
132 # define WXDLLIMPEXP_ODBC WXEXPORT
133 # define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type
134 #elif defined(WXUSINGDLL)
135 # define WXDLLIMPEXP_ODBC WXIMPORT
136 # define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type
137 #else /* not making nor using DLL */
138 # define WXDLLIMPEXP_ODBC
139 # define WXDLLIMPEXP_DATA_ODBC(type) type
142 #ifdef WXMAKINGDLL_DBGRID
143 # define WXDLLIMPEXP_DBGRID WXEXPORT
144 # define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type
145 #elif defined(WXUSINGDLL)
146 # define WXDLLIMPEXP_DBGRID WXIMPORT
147 # define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type
148 #else /* not making nor using DLL */
149 # define WXDLLIMPEXP_DBGRID
150 # define WXDLLIMPEXP_DATA_DBGRID(type) type
153 #ifdef WXMAKINGDLL_HTML
154 # define WXDLLIMPEXP_HTML WXEXPORT
155 # define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type
156 #elif defined(WXUSINGDLL)
157 # define WXDLLIMPEXP_HTML WXIMPORT
158 # define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type
159 #else /* not making nor using DLL */
160 # define WXDLLIMPEXP_HTML
161 # define WXDLLIMPEXP_DATA_HTML(type) type
164 #ifdef WXMAKINGDLL_GL
165 # define WXDLLIMPEXP_GL WXEXPORT
166 #elif defined(WXUSINGDLL)
167 # define WXDLLIMPEXP_GL WXIMPORT
168 #else /* not making nor using DLL */
169 # define WXDLLIMPEXP_GL
172 #ifdef WXMAKINGDLL_XML
173 # define WXDLLIMPEXP_XML WXEXPORT
174 #elif defined(WXUSINGDLL)
175 # define WXDLLIMPEXP_XML WXIMPORT
176 #else /* not making nor using DLL */
177 # define WXDLLIMPEXP_XML
180 /* for backwards compatibility, define suffix-less versions too */
181 #define WXDLLEXPORT WXDLLIMPEXP_CORE
182 #define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE
184 #endif /* _WX_DLIMPEXP_H_ */