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