This is Unofficial EPICS BASE Doxygen Site
shareLib.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
119 #undef epicsShareExtern
120 #undef epicsShareDef
121 #undef epicsShareClass
122 #undef epicsShareFunc
123 #undef epicsShareAPI
124 #undef READONLY
125 
126 #if defined(_WIN32) || defined(__CYGWIN__)
127 /*
128  * Check if EPICS_BUILD_DLL or EPICS_CALL_DLL defined and use the dllimport/
129  * dllexport keywords if this is a shared library build of base under WIN32.
130  */
131 
132 # if defined(epicsExportSharedSymbols)
133 # if defined(EPICS_BUILD_DLL)
134 # define epicsShareExtern __declspec(dllexport) extern
135 # define epicsShareClass __declspec(dllexport)
136 # define epicsShareFunc __declspec(dllexport)
137 # else
138 # define epicsShareExtern extern
139 # define epicsShareClass
140 # define epicsShareFunc
141 # endif
142 # else
143 # if defined(EPICS_CALL_DLL)
144 # define epicsShareExtern __declspec(dllimport) extern
145 # define epicsShareClass __declspec(dllimport)
146 # define epicsShareFunc __declspec(dllimport)
147 # else
148 # define epicsShareExtern extern
149 # define epicsShareClass
150 # define epicsShareFunc
151 # endif
152 # endif
153 # define epicsShareDef
154 # define epicsShareAPI __stdcall /* function removes arguments */
155 # define READONLY const
156 
157 #elif __GNUC__ >= 4
158 /*
159  * See http://gcc.gnu.org/wiki/Visibility
160  * For these to work, gcc must be given the flag
161  * -fvisibility=hidden
162  * and g++ the flags
163  * -fvisibility=hidden -fvisibility-inlines-hidden
164  */
165 
166 # define epicsShareExtern __attribute__ ((visibility("default"))) extern
167 # define epicsShareClass __attribute__ ((visibility("default")))
168 # define epicsShareFunc __attribute__ ((visibility("default")))
169 
170 # define epicsShareDef
171 # define epicsShareAPI
172 # if defined(__STDC__) || defined (__cplusplus)
173 # define READONLY const
174 # else
175 # define READONLY
176 # endif
177 
178 /*
179  * if its the old VAX C Compiler (not DEC C)
180  */
181 #elif defined(VAXC)
182 
183  /*
184  * VAXC creates FORTRAN common blocks when
185  * we use "extern int fred"/"int fred=4". Therefore,
186  * the initialization is not loaded unless we
187  * call a function in that object module.
188  *
189  * DEC CXX does not have this problem.
190  * We suspect (but do not know) that DEC C
191  * also does not have this problem.
192  */
193 # define epicsShareExtern globalref
194 # define epicsShareDef globaldef
195 # define READONLY const
196 # define epicsShareClass
197 # define epicsShareFunc
198 # define epicsShareAPI
199 
200 #else
201 
202 /* else => no import/export specifiers */
203 
204 # define epicsShareExtern extern
205 # define epicsShareAPI
206 # define epicsShareClass
207 # define epicsShareDef
208 
209 # define epicsShareFunc
210 # if defined(__STDC__) || defined (__cplusplus)
211 # define READONLY const
212 # else
213 # define READONLY
214 # endif
215 
216 #endif
217 
218 #ifndef INLINE_defs_EPICS
219 #define INLINE_defs_EPICS
220 # ifndef __cplusplus
221 # if defined (__GNUC__)
222 # define INLINE static __inline__
223 # elif defined (_MSC_VER)
224 # define INLINE __inline
225 # elif defined (_SUNPRO_C)
226 # pragma error_messages (off, E_EXTERN_PRIOR_REDECL_STATIC)
227 # define INLINE static
228 # else
229 # define INLINE static
230 # endif
231 # endif /* ifndef __cplusplus */
232 #endif /* ifdef INLINE_defs_EPICS */