]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/dlimpexp.h
Fixed to work with the new wxMacControl system.
[wxWidgets.git] / include / wx / dlimpexp.h
... / ...
CommitLineData
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#endif /* WXMAKINGDLL */
82
83/*
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
86 */
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
96#endif
97
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
107#endif
108
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
118#endif
119
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
129#endif
130
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
140#endif
141
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
151#endif
152
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
162#endif
163
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
170#endif
171
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
178#endif
179
180/* for backwards compatibility, define suffix-less versions too */
181#define WXDLLEXPORT WXDLLIMPEXP_CORE
182#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE
183
184#endif /* _WX_DLIMPEXP_H_ */
185