Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
BIAS_DeclSpec.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003, 2004 (see file CONTACTS for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 /*
26 /// defines the BIAS API
27 /// required for building/using a WIN32 DLL
28 ///
29 /// Is edited by hand.
30 /// Add one unique define for each additinal lib.
31 ///
32 /// case 1: Linux. expand to nothing, no difference betwen static (.a) and shared (.so) build
33 ///
34 /// case 2: Windows:
35 /// case 2.1: On compilation:
36 /// case 2.1.1: static : expand to nothing
37 /// case 2.1.2: shared : expand to ...export (on compilation)
38 ///
39 /// case 2.2: On using the headers/linking against this by third party lib:
40 /// case 2.2.1: was static build : expand to nothing
41 /// case 2.2.2: was shared build : expand to ...import (because it *was* compiled as a dll with export)
42 ///
43 /// Thus on *usage* of this file we need to know if we are using BIAS as shared or static build.
44 /// This file is typically globally included through <bias_config.h>
45 ///
46 /// @author Jan Woetzel 2005/11/01-2006
47 ///
48 */
49 
50 #ifndef _BIAS_DeclSpec__hh__
51 #define _BIAS_DeclSpec__hh__
52 
53 
54 #include <bias_config.h>
55 
56 #if defined (WIN32) && defined(BIAS_BUILD_SHARED_LIBS)
57 
58 /*
59  we need to define export on compilation or import on use.
60  We exploit that cmakes auto setting xxx_EXPORTS (with S) on compliation
61 
62  We need to write one switches for each built lib explicitly
63  because nested macros dont work with preprocessor.
64  Jan Woetzel, 2005
65  */
66 
67 
68 # ifdef BIASCommon_EXPORTS
69 # define BIASCommon_EXPORT __declspec(dllexport)
70 # else
71 # define BIASCommon_EXPORT __declspec(dllimport)
72 # endif
73 
74 # ifdef BIASDebug_EXPORTS
75 # define BIASDebug_EXPORT __declspec(dllexport)
76 # else
77 # define BIASDebug_EXPORT __declspec(dllimport)
78 # endif
79 
80 # ifdef BIASFeatureDetector_EXPORTS
81 # define BIASFeatureDetector_EXPORT __declspec(dllexport)
82 # else
83 # define BIASFeatureDetector_EXPORT __declspec(dllimport)
84 # endif
85 
86 # ifdef BIASFilter_EXPORTS
87 # define BIASFilter_EXPORT __declspec(dllexport)
88 # else
89 # define BIASFilter_EXPORT __declspec(dllimport)
90 # endif
91 
92 # ifdef BIASGeometry_EXPORTS
93 # define BIASGeometry_EXPORT __declspec(dllexport)
94 # else
95 # define BIASGeometry_EXPORT __declspec(dllimport)
96 # endif
97 
98 # ifdef BIASGeometryBase_EXPORTS
99 # define BIASGeometryBase_EXPORT __declspec(dllexport)
100 # else
101 # define BIASGeometryBase_EXPORT __declspec(dllimport)
102 # endif
103 
104 # ifdef BIASGui_EXPORTS
105 # define BIASGui_EXPORT __declspec(dllexport)
106 # else
107 # define BIASGui_EXPORT __declspec(dllimport)
108 # endif
109 
110 # ifdef BIASImage_EXPORTS
111 # define BIASImage_EXPORT __declspec(dllexport)
112 # else
113 # define BIASImage_EXPORT __declspec(dllimport)
114 # endif
115 
116 # ifdef BIASImageBase_EXPORTS
117 # define BIASImageBase_EXPORT __declspec(dllexport)
118 # else
119 # define BIASImageBase_EXPORT __declspec(dllimport)
120 # endif
121 
122 # ifdef BIASImageUtilsBase_EXPORTS
123 # define BIASImageUtilsBase_EXPORT __declspec(dllexport)
124 # else
125 # define BIASImageUtilsBase_EXPORT __declspec(dllimport)
126 # endif
127 
128 # ifdef BIASMatcher2D_EXPORTS
129 # define BIASMatcher2D_EXPORT __declspec(dllexport)
130 # else
131 # define BIASMatcher2D_EXPORT __declspec(dllimport)
132 # endif
133 
134 # ifdef BIASMathAlgo_EXPORTS
135 # define BIASMathAlgo_EXPORT __declspec(dllexport)
136 # else
137 # define BIASMathAlgo_EXPORT __declspec(dllimport)
138 # endif
139 
140 # ifdef BIASMathBase_EXPORTS
141 # define BIASMathBase_EXPORT __declspec(dllexport)
142 # else
143 # define BIASMathBase_EXPORT __declspec(dllimport)
144 # endif
145 
146 # ifdef BIASOpenGLFramework_EXPORTS
147 # define BIASOpenGLFramework_EXPORT __declspec(dllexport)
148 # else
149 # define BIASOpenGLFramework_EXPORT __declspec(dllimport)
150 # endif
151 
152 # ifdef BIASOpenCLFramework_EXPORTS
153 # define BIASOpenCLFramework_EXPORT __declspec(dllexport)
154 # else
155 # define BIASOpenCLFramework_EXPORT __declspec(dllimport)
156 # endif
157 
158 # ifdef BIASPanTilt_EXPORTS
159 # define BIASPanTilt_EXPORT __declspec(dllexport)
160 # else
161 # define BIASPanTilt_EXPORT __declspec(dllimport)
162 # endif
163 
164 # ifdef BIASStateEstimator_EXPORTS
165 # define BIASStateEstimator_EXPORT __declspec(dllexport)
166 # else
167 # define BIASStateEstimator_EXPORT __declspec(dllimport)
168 # endif
169 
170 # ifdef BIASNetworkComm_EXPORTS
171 # define BIASNetworkComm_EXPORT __declspec(dllexport)
172 # else
173 # define BIASNetworkComm_EXPORT __declspec(dllimport)
174 # endif
175 
176 # ifdef BIASVideoSource_EXPORTS
177 # define BIASVideoSource_EXPORT __declspec(dllexport)
178 # else
179 # define BIASVideoSource_EXPORT __declspec(dllimport)
180 # endif
181 
182 # ifdef BIASUtils_EXPORTS
183 # define BIASUtils_EXPORT __declspec(dllexport)
184 # else
185 # define BIASUtils_EXPORT __declspec(dllimport)
186 # endif
187 
188 # ifdef BIASVideoSink_EXPORTS
189 # define BIASVideoSink_EXPORT __declspec(dllexport)
190 # else
191 # define BIASVideoSink_EXPORT __declspec(dllimport)
192 # endif
193 
194 # ifdef BIASSimpleGLApp_EXPORTS
195 # define BIASSimpleGLApp_EXPORT __declspec(dllexport)
196 # else
197 # define BIASSimpleGLApp_EXPORT __declspec(dllimport)
198 # endif
199 
200 # ifdef BIASGLviewer_EXPORTS
201 # define BIASGLviewer_EXPORT __declspec(dllexport)
202 # else
203 # define BIASGLviewer_EXPORT __declspec(dllimport)
204 # endif
205 
206 
207 
208 /*
209  getting the export for STL/DTL into DLLs is quite tricky on MS Windows.
210  We use "manual" explicit instantiation to reach interfaced class variable
211 
212  See http://support.microsoft.com/kb/q168958/
213  and
214  http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html
215 
216 
217  See BIAS/Filter/Label.hh for usage example.
218 */
219 #define BIAS_EXPORT_STL_VECTOR( dllmacro, vectype ) \
220  template class dllmacro std::allocator< vectype >; \
221  template class dllmacro std::vector<vectype, std::allocator< vectype > >;
222 
223 
224 #define BIAS_EXPORT_STL_SET( dllmacro, settype ) \
225  template class dllmacro std::allocator< settype >; \
226  template struct dllmacro std::less< settype >; \
227  template class dllmacro std::allocator< \
228  std::_Tree_nod<std::_Tset_traits<settype,std::less<settype>, \
229  std::allocator<settype>,false> > >; \
230  template class dllmacro std::allocator< \
231  std::_Tree_ptr<std::_Tset_traits<settype,std::less<settype>, \
232  std::allocator<settype>,false> > >; \
233  template class dllmacro std::_Tree_ptr< \
234  std::_Tset_traits<settype,std::less<settype>, \
235  std::allocator<settype>,false> >; \
236  template class dllmacro std::_Tree_nod< \
237  std::_Tset_traits<settype,std::less<settype>, \
238  std::allocator<settype>,false> >; \
239  template class dllmacro std::_Tree_val< \
240  std::_Tset_traits<settype,std::less<settype>, \
241  std::allocator<settype>,false> >; \
242  template class dllmacro std::set< settype, std::less< settype >, \
243  std::allocator< settype > >;
244 
245 /* include BIAS-W32 compatibility */
246 #include <Base/Common/W32Compat.hh>
247 
248 # else /* (WIN32) && defined(BIAS_BUILD_SHARED_LIBS) */
249 
250 /* we are either running Linux or building static,
251  thus expand to nothing
252  Jan Woetzel
253 */
254 
255 # define BIASCommon_EXPORT
256 # define BIASDebug_EXPORT
257 # define BIASFeatureDetector_EXPORT
258 # define BIASFilter_EXPORT
259 # define BIASGeometry_EXPORT
260 # define BIASGeometryBase_EXPORT
261 # define BIASGui_EXPORT
262 # define BIASImage_EXPORT
263 # define BIASImageBase_EXPORT
264 # define BIASImageUtilsBase_EXPORT
265 # define BIASMatcher2D_EXPORT
266 # define BIASMathAlgo_EXPORT
267 # define BIASMathBase_EXPORT
268 # define BIASOpenGLFramework_EXPORT
269 # define BIASOpenCLFramework_EXPORT
270 # define BIASPanTilt_EXPORT
271 # define BIASStateEstimator_EXPORT
272 # define BIASUtils_EXPORT
273 # define BIASNetworkComm_EXPORT
274 # define BIASVideoSource_EXPORT
275 # define BIASVideoSink_EXPORT
276 # define BIASSimpleGLApp_EXPORT
277 # define BIASGLviewer_EXPORT
278 
279 
280 
281 /* DLL: nothing to export (Jan Woetzel) */
282 #define BIAS_EXPORT_STL_VECTOR( dllmacro, vectype )
283 #define BIAS_EXPORT_STL_SET( dllmacro, settype )
284 /* #define BIAS_EXPORT_STL_MAP( dllmacro, mapkey, mapvalue ) */
285 
286 #endif /* (WIN32) && defined(BIAS_BUILD_SHARED_LIBS) --------------------- */
287 
288 #endif /* _BIAS_DeclSpec__hh__ */