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