]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dlimpexp.h
added wxStaticCast, moved wxConstCast from wx/object.h to wx/defs.h for consistency
[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$
8 * Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.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(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
40# define WXEXPORT _Export
41# define WXIMPORT _Export
42# endif
43#elif defined(__WXMAC__) || defined(__WXCOCOA__)
44# ifdef __MWERKS__
45# define WXEXPORT __declspec(export)
46# define WXIMPORT __declspec(import)
47# endif
48#endif
49
50/* for other platforms/compilers we don't anything */
51#ifndef WXEXPORT
52# define WXEXPORT
53# define WXIMPORT
54#endif
55
56/*
57 We support building wxWindows as a set of several libraries but we don't
58 support arbitrary combinations of libs/DLLs: either we build all of them as
59 DLLs (in which case WXMAKINGDLL is defined) or none (it isn't).
60
61 However we have a problem because we need separate WXDLLEXPORT versions for
62 different libraries as, for example, wxString class should be dllexported
63 when compiled in wxBase and dllimported otherwise, so we do define separate
64 WXMAKING/USINGDLL_XYZ constants for each component XYZ.
65 */
66#ifdef WXMAKINGDLL
67# if wxUSE_BASE
68# define WXMAKINGDLL_BASE
69# endif
70
71# define WXMAKINGDLL_NET
72# define WXMAKINGDLL_CORE
73# define WXMAKINGDLL_ADV
74# define WXMAKINGDLL_ODBC
75# define WXMAKINGDLL_DBGRID
76# define WXMAKINGDLL_HTML
77# define WXMAKINGDLL_XML
78#endif /* WXMAKINGDLL */
79
80/*
81 WXDLLEXPORT maps to export declaration when building the DLL, to import
82 declaration if using it or to nothing at all if we don't use wxWin as DLL
83 */
84#ifdef WXMAKINGDLL_BASE
85# define WXDLLIMPEXP_BASE WXEXPORT
86# define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type
87#elif defined(WXUSINGDLL)
88# define WXDLLIMPEXP_BASE WXIMPORT
89# define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type
90#else /* not making nor using DLL */
91# define WXDLLIMPEXP_BASE
92# define WXDLLIMPEXP_DATA_BASE(type) type
93#endif
94
95#ifdef WXMAKINGDLL_NET
96# define WXDLLIMPEXP_NET WXEXPORT
97# define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type
98#elif defined(WXUSINGDLL)
99# define WXDLLIMPEXP_NET WXIMPORT
100# define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type
101#else /* not making nor using DLL */
102# define WXDLLIMPEXP_NET
103# define WXDLLIMPEXP_DATA_NET(type) type
104#endif
105
106#ifdef WXMAKINGDLL_CORE
107# define WXDLLIMPEXP_CORE WXEXPORT
108# define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type
109#elif defined(WXUSINGDLL)
110# define WXDLLIMPEXP_CORE WXIMPORT
111# define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type
112#else /* not making nor using DLL */
113# define WXDLLIMPEXP_CORE
114# define WXDLLIMPEXP_DATA_CORE(type) type
115#endif
116
117#ifdef WXMAKINGDLL_ADV
118# define WXDLLIMPEXP_ADV WXEXPORT
119# define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type
120#elif defined(WXUSINGDLL)
121# define WXDLLIMPEXP_ADV WXIMPORT
122# define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type
123#else /* not making nor using DLL */
124# define WXDLLIMPEXP_ADV
125# define WXDLLIMPEXP_DATA_ADV(type) type
126#endif
127
128#ifdef WXMAKINGDLL_ODBC
129# define WXDLLIMPEXP_ODBC WXEXPORT
130# define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type
131#elif defined(WXUSINGDLL)
132# define WXDLLIMPEXP_ODBC WXIMPORT
133# define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type
134#else /* not making nor using DLL */
135# define WXDLLIMPEXP_ODBC
136# define WXDLLIMPEXP_DATA_ODBC(type) type
137#endif
138
139#ifdef WXMAKINGDLL_DBGRID
140# define WXDLLIMPEXP_DBGRID WXEXPORT
141# define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type
142#elif defined(WXUSINGDLL)
143# define WXDLLIMPEXP_DBGRID WXIMPORT
144# define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type
145#else /* not making nor using DLL */
146# define WXDLLIMPEXP_DBGRID
147# define WXDLLIMPEXP_DATA_DBGRID(type) type
148#endif
149
150#ifdef WXMAKINGDLL_HTML
151# define WXDLLIMPEXP_HTML WXEXPORT
152# define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type
153#elif defined(WXUSINGDLL)
154# define WXDLLIMPEXP_HTML WXIMPORT
155# define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type
156#else /* not making nor using DLL */
157# define WXDLLIMPEXP_HTML
158# define WXDLLIMPEXP_DATA_HTML(type) type
159#endif
160
161#ifdef WXMAKINGDLL_GL
162# define WXDLLIMPEXP_GL WXEXPORT
163#elif defined(WXUSINGDLL)
164# define WXDLLIMPEXP_GL WXIMPORT
165#else /* not making nor using DLL */
166# define WXDLLIMPEXP_GL
167#endif
168
169#ifdef WXMAKINGDLL_XML
170# define WXDLLIMPEXP_XML WXEXPORT
171#elif defined(WXUSINGDLL)
172# define WXDLLIMPEXP_XML WXIMPORT
173#else /* not making nor using DLL */
174# define WXDLLIMPEXP_XML
175#endif
176
177/* for backwards compatibility, define suffix-less versions too */
178#define WXDLLEXPORT WXDLLIMPEXP_CORE
179#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE
180
181#endif /* _WX_DLIMPEXP_H_ */
182