2 * This handles GCC attributes
4 * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
6 * Copyright (C) 2005-2010
7 * Ludovic Rousseau <ludovic.rousseau@free.fr>
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
13 1. Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15 2. Redistributions in binary form must reproduce the above copyright
16 notice, this list of conditions and the following disclaimer in the
17 documentation and/or other materials provided with the distribution.
18 3. The name of the author may not be used to endorse or promote products
19 derived from this software without specific prior written permission.
21 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 * Declare the function as internal to the library: the function name is
38 * not exported and can't be used by a program linked to the library
40 * see http://gcc.gnu.org/onlinedocs/gcc-3.3.5/gcc/Function-Attributes.html#Function-Attributes
41 * see http://www.nedprod.com/programs/gccvisibility.html
43 #if defined(__GNUC__) && \
44 (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) || \
45 defined(__SUNPRO_C) && __SUNPRO_C >= 0x590
46 #define INTERNAL __attribute__ ((visibility("hidden")))
48 #define PCSC_API __attribute__ ((visibility("default")))
50 #elif defined(__SUNPRO_C) && __SUNPRO_C >= 0x550
51 /* http://wikis.sun.com/display/SunStudio/Macros+for+Shared+Library+Symbol+Visibility */
52 #define INTERNAL __hidden
53 #define PCSC_API __global
58 #define EXTERNAL PCSC_API
62 /* GNU Compiler Collection (GCC) */
63 #define CONSTRUCTOR __attribute__ ((constructor))
64 #define DESTRUCTOR __attribute__ ((destructor))
68 /* SUN C compiler does not use __attribute__ but #pragma init (function)
69 * We can't use a # inside a #define so it is not possible to use
70 * #define CONSTRUCTOR_DECLARATION(x) #pragma init (x)
71 * The #pragma is used directly where needed */
80 #define min(a,b) (((a) < (b)) ? (a) : (b))
84 #define COUNT_OF(arr) (sizeof(arr)/sizeof(arr[0]))
87 #endif /* __misc_h__ */