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