misc.h

00001 /*
00002  * This handles GCC attributes
00003  *
00004  * MUSCLE SmartCard Development ( http://www.linuxnet.com )
00005  *
00006  * Copyright (C) 2005
00007  *  Ludovic Rousseau <ludovic.rousseau@free.fr>
00008  *
00009  * $Id: misc.h 2481 2007-03-15 08:23:07Z rousseau $
00010  */
00011 
00012 #ifndef __misc_h__
00013 #define __misc_h__
00014 
00015 #ifdef __cplusplus
00016 extern "C"
00017 {
00018 #endif
00019 
00020 /*
00021  * Declare the function as internal to the library: the function name is
00022  * not exported and can't be used by a program linked to the library
00023  *
00024  * see http://gcc.gnu.org/onlinedocs/gcc-3.3.5/gcc/Function-Attributes.html#Function-Attributes
00025  * see http://www.nedprod.com/programs/gccvisibility.html
00026  */
00027 #if defined __GNUC__ && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
00028 #define INTERNAL __attribute__ ((visibility("hidden")))
00029 #define PCSC_API __attribute__ ((visibility("default")))
00030 #else
00031 #define INTERNAL
00032 #define PCSC_API
00033 #endif
00034 #define EXTERNAL PCSC_API
00035 
00036 #if defined __GNUC__
00037 
00038 /* GNU Compiler Collection (GCC) */
00039 #define CONSTRUCTOR __attribute__ ((constructor))
00040 #define DESTRUCTOR __attribute__ ((destructor))
00041 
00042 #else
00043 
00044 /* SUN C compiler does not use __attribute__ but #pragma init (function)
00045  * We can't use a # inside a #define so it is not possible to use
00046  * #define CONSTRUCTOR_DECLARATION(x) #pragma init (x)
00047  * The #pragma is used directly where needed */
00048 
00049 /* any other */
00050 #define CONSTRUCTOR
00051 #define DESTRUCTOR
00052 
00053 #endif
00054 
00055 #ifndef min
00056 #define min(a,b) (((a) < (b)) ? (a) : (b))
00057 #endif
00058 
00059 #ifdef __cplusplus
00060 }
00061 #endif
00062 
00063 #endif /* __misc_h__ */

Generated on Mon Aug 17 01:00:09 2009 for pcsc-lite by  doxygen 1.5.9