]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dlimpexp.h
use slashes instead of backslashes and quotes instead of angle brackets in all #includes
[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 #endif
52
53 /* for other platforms/compilers we don't anything */
54 #ifndef WXEXPORT
55 # define WXEXPORT
56 # define WXIMPORT
57 #endif
58
59 /*
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).
63
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.
68 */
69 #ifdef WXMAKINGDLL
70 # if wxUSE_BASE
71 # define WXMAKINGDLL_BASE
72 # endif
73
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 # define WXMAKINGDLL_XRC
82 #endif /* WXMAKINGDLL */
83
84 /*
85 WXDLLEXPORT maps to export declaration when building the DLL, to import
86 declaration if using it or to nothing at all if we don't use wxWin as DLL
87 */
88 #ifdef WXMAKINGDLL_BASE
89 # define WXDLLIMPEXP_BASE WXEXPORT
90 # define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type
91 #elif defined(WXUSINGDLL)
92 # define WXDLLIMPEXP_BASE WXIMPORT
93 # define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type
94 #else /* not making nor using DLL */
95 # define WXDLLIMPEXP_BASE
96 # define WXDLLIMPEXP_DATA_BASE(type) type
97 #endif
98
99 #ifdef WXMAKINGDLL_NET
100 # define WXDLLIMPEXP_NET WXEXPORT
101 # define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type
102 #elif defined(WXUSINGDLL)
103 # define WXDLLIMPEXP_NET WXIMPORT
104 # define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type
105 #else /* not making nor using DLL */
106 # define WXDLLIMPEXP_NET
107 # define WXDLLIMPEXP_DATA_NET(type) type
108 #endif
109
110 #ifdef WXMAKINGDLL_CORE
111 # define WXDLLIMPEXP_CORE WXEXPORT
112 # define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type
113 #elif defined(WXUSINGDLL)
114 # define WXDLLIMPEXP_CORE WXIMPORT
115 # define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type
116 #else /* not making nor using DLL */
117 # define WXDLLIMPEXP_CORE
118 # define WXDLLIMPEXP_DATA_CORE(type) type
119 #endif
120
121 #ifdef WXMAKINGDLL_ADV
122 # define WXDLLIMPEXP_ADV WXEXPORT
123 # define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type
124 #elif defined(WXUSINGDLL)
125 # define WXDLLIMPEXP_ADV WXIMPORT
126 # define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type
127 #else /* not making nor using DLL */
128 # define WXDLLIMPEXP_ADV
129 # define WXDLLIMPEXP_DATA_ADV(type) type
130 #endif
131
132 #ifdef WXMAKINGDLL_ODBC
133 # define WXDLLIMPEXP_ODBC WXEXPORT
134 # define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type
135 #elif defined(WXUSINGDLL)
136 # define WXDLLIMPEXP_ODBC WXIMPORT
137 # define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type
138 #else /* not making nor using DLL */
139 # define WXDLLIMPEXP_ODBC
140 # define WXDLLIMPEXP_DATA_ODBC(type) type
141 #endif
142
143 #ifdef WXMAKINGDLL_DBGRID
144 # define WXDLLIMPEXP_DBGRID WXEXPORT
145 # define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type
146 #elif defined(WXUSINGDLL)
147 # define WXDLLIMPEXP_DBGRID WXIMPORT
148 # define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type
149 #else /* not making nor using DLL */
150 # define WXDLLIMPEXP_DBGRID
151 # define WXDLLIMPEXP_DATA_DBGRID(type) type
152 #endif
153
154 #ifdef WXMAKINGDLL_HTML
155 # define WXDLLIMPEXP_HTML WXEXPORT
156 # define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type
157 #elif defined(WXUSINGDLL)
158 # define WXDLLIMPEXP_HTML WXIMPORT
159 # define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type
160 #else /* not making nor using DLL */
161 # define WXDLLIMPEXP_HTML
162 # define WXDLLIMPEXP_DATA_HTML(type) type
163 #endif
164
165 #ifdef WXMAKINGDLL_GL
166 # define WXDLLIMPEXP_GL WXEXPORT
167 #elif defined(WXUSINGDLL)
168 # define WXDLLIMPEXP_GL WXIMPORT
169 #else /* not making nor using DLL */
170 # define WXDLLIMPEXP_GL
171 #endif
172
173 #ifdef WXMAKINGDLL_XML
174 # define WXDLLIMPEXP_XML WXEXPORT
175 #elif defined(WXUSINGDLL)
176 # define WXDLLIMPEXP_XML WXIMPORT
177 #else /* not making nor using DLL */
178 # define WXDLLIMPEXP_XML
179 #endif
180
181 #ifdef WXMAKINGDLL_XRC
182 # define WXDLLIMPEXP_XRC WXEXPORT
183 #elif defined(WXUSINGDLL)
184 # define WXDLLIMPEXP_XRC WXIMPORT
185 #else /* not making nor using DLL */
186 # define WXDLLIMPEXP_XRC
187 #endif
188
189 /* for backwards compatibility, define suffix-less versions too */
190 #define WXDLLEXPORT WXDLLIMPEXP_CORE
191 #define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE
192
193 #endif /* _WX_DLIMPEXP_H_ */
194