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