globalplatform
library.h
Go to the documentation of this file.
1 /* Copyright (c) 2008, Karsten Ohme
2  * This file is part of GlobalPlatform.
3  *
4  * GlobalPlatform is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * GlobalPlatform is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with GlobalPlatform. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
22 #ifndef OPGP_LIBRARY_H
23 #define OPGP_LIBRARY_H
24 
25 // dynamic library
26 #if (defined(WIN32) || defined __CYGWIN__)
27  #ifdef OPGP_EXPORTS
28  #ifdef __GNUC__
29  #define OPGP_API __attribute__((dllexport))
30  #else
31  #define OPGP_API __declspec(dllexport)
32  #endif
33  #else
34  #ifdef __GNUC__
35  #define OPGP_API __attribute__((dllimport))
36  #else
37  #define OPGP_API __declspec(dllimport)
38  #endif
39  #endif
40  #define OPGP_NO_API
41 #else
42  #if defined __GNUC__ && (__GNUC__ >= 4)
43  #define OPGP_API __attribute__ ((visibility("default")))
44  #define OPGP_NO_API __attribute__ ((visibility("hidden")))
45  #else
46  #define OPGP_API
47  #define OPGP_NO_API
48  #endif
49 #endif // #if (defined(WIN32) || defined __CYGWIN__)
50 
51 // for plugin libhraries
52 #if (defined(WIN32) || defined __CYGWIN__)
53  #ifdef OPGP_PL_EXPORTS
54  #ifdef __GNUC__
55  #define OPGP_PL_API __attribute__((dllexport))
56  #else
57  #define OPGP_PL_API __declspec(dllexport)
58  #endif
59  #else
60  #ifdef __GNUC__
61  #define OPGP_PL_API __attribute__((dllimport))
62  #else
63  #define OPGP_PL_API __declspec(dllimport)
64  #endif
65  #endif
66 #else
67  #if defined __GNUC__ && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
68  #define OPGP_PL_API __attribute__ ((visibility("default")))
69  #else
70  #define OPGP_PL_API
71  #endif
72 #endif // #if (defined(WIN32) || defined __CYGWIN__)
73 
74 
75 #if defined __GNUC__
76 
77 /* GNU Compiler Collection (GCC) */
78 #define CONSTRUCTOR __attribute__ ((constructor))
79 #define DESTRUCTOR __attribute__ ((destructor))
80 
81 #else
82 
83 /* SUN C compiler does not use __attribute__ but #pragma init (function)
84  * We can't use a # inside a #define so it is not possible to use
85  * #define CONSTRUCTOR_DECLARATION(x) #pragma init (x)
86  * The #pragma is used directly where needed */
87 
88 /* any other */
89 #define CONSTRUCTOR
90 #define DESTRUCTOR
91 
92 #endif
93 
94 #endif
95 
96 
97 
98 
99 
100