1/*
2 * This handles GCC attributes
3 *
4 * MUSCLE SmartCard Development ( http://www.linuxnet.com )
5 *
6 * Copyright (C) 2005
7 *  Ludovic Rousseau <ludovic.rousseau@free.fr>
8 *
9 * $Id: pcscexport.h 123 2010-03-27 10:50:42Z ludovic.rousseau@gmail.com $
10 */
11
12#ifndef __misc_h__
13#define __misc_h__
14
15#ifdef __cplusplus
16extern "C"
17{
18#endif
19
20/*
21 * Declare the function as internal to the library: the function name is
22 * not exported and can't be used by a program linked to the library
23 *
24 * see http://gcc.gnu.org/onlinedocs/gcc-3.3.5/gcc/Function-Attributes.html#Function-Attributes
25 * see http://www.nedprod.com/programs/gccvisibility.html
26 */
27#if defined __GNUC__ && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
28#define INTERNAL __attribute__ ((visibility("hidden")))
29/*
30#define PCSC_API __attribute__ ((visibility("default")))
31We don't want to change how this was defined in previous versions*/
32#define PCSC_API
33#else
34#define INTERNAL
35#define PCSC_API
36#endif
37#define EXTERNAL PCSC_API
38
39#if defined __GNUC__
40
41/* GNU Compiler Collection (GCC) */
42#define CONSTRUCTOR __attribute__ ((constructor))
43#define DESTRUCTOR __attribute__ ((destructor))
44
45#else
46
47/* SUN C compiler does not use __attribute__ but #pragma init (function)
48 * We can't use a # inside a #define so it is not possible to use
49 * #define CONSTRUCTOR_DECLARATION(x) #pragma init (x)
50 * The #pragma is used directly where needed */
51
52/* any other */
53#define CONSTRUCTOR
54#define DESTRUCTOR
55
56#endif
57
58#ifdef __cplusplus
59}
60#endif
61
62#endif /* __misc_h__ */
63