Initial check-in
[shibboleth/cpp-xmltooling.git] / xmltooling / base.h
1 /*\r
2  *  Copyright 2001-2006 Internet2\r
3  * \r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *     http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 /**\r
18  * @file base.h\r
19  * \r
20  * Base header file definitions\r
21  * Must be included prior to including any other header\r
22  */\r
23 \r
24 #if !defined(__xmltooling_base_h__)\r
25 #define __xmltooling_base_h__\r
26 \r
27 #if defined (_MSC_VER) || defined(__BORLANDC__)\r
28   #include <xmltooling/config_pub_win32.h>\r
29 #else\r
30   #include <xmltooling/config_pub.h>\r
31 #endif\r
32 \r
33 /**\r
34  * @namespace xmltooling\r
35  * Public namespace of XML Tooling library\r
36  */\r
37 \r
38 // Windows and GCC4 Symbol Visibility Macros\r
39 \r
40 #ifdef WIN32\r
41   #define XMLTOOL_IMPORT __declspec(dllimport)\r
42   #define XMLTOOL_EXPORT __declspec(dllexport)\r
43   #define XMLTOOL_DLLLOCAL\r
44   #define XMLTOOL_DLLPUBLIC\r
45 #else\r
46   #define XMLTOOL_IMPORT\r
47   #ifdef GCC_HASCLASSVISIBILITY\r
48     #define XMLTOOL_EXPORT __attribute__ ((visibility("default")))\r
49     #define XMLTOOL_DLLLOCAL __attribute__ ((visibility("hidden")))\r
50     #define XMLTOOL_DLLPUBLIC __attribute__ ((visibility("default")))\r
51   #else\r
52     #define XMLTOOL_EXPORT\r
53     #define XMLTOOL_DLLLOCAL\r
54     #define XMLTOOL_DLLPUBLIC\r
55   #endif\r
56 #endif\r
57 \r
58 // Define XMLTOOL_API for DLL builds\r
59 #ifdef XMLTOOLING_EXPORTS\r
60   #define XMLTOOL_API XMLTOOL_EXPORT\r
61 #else\r
62   #define XMLTOOL_API XMLTOOL_IMPORT\r
63 #endif\r
64 \r
65 // Throwable classes must always be visible on GCC in all binaries\r
66 #ifdef WIN32\r
67   #define XMLTOOL_EXCEPTIONAPI(api) api\r
68 #elif defined(GCC_HASCLASSVISIBILITY)\r
69   #define XMLTOOL_EXCEPTIONAPI(api) XMLTOOL_EXPORT\r
70 #else\r
71   #define XMLTOOL_EXCEPTIONAPI(api)\r
72 #endif\r
73 \r
74 #endif /* __xmltooling_base_h__ */\r