Imported Upstream version 2.9.1
[platform/upstream/libxml2.git] / include / libxml / xmlexports.h
1 /*
2  * Summary: macros for marking symbols as exportable/importable.
3  * Description: macros for marking symbols as exportable/importable.
4  *
5  * Copy: See Copyright for the status of this software.
6  *
7  * Author: Igor Zlatovic <igor@zlatkovic.com>
8  */
9
10 #ifndef __XML_EXPORTS_H__
11 #define __XML_EXPORTS_H__
12
13 /**
14  * XMLPUBFUN, XMLPUBVAR, XMLCALL
15  *
16  * Macros which declare an exportable function, an exportable variable and
17  * the calling convention used for functions.
18  *
19  * Please use an extra block for every platform/compiler combination when
20  * modifying this, rather than overlong #ifdef lines. This helps
21  * readability as well as the fact that different compilers on the same
22  * platform might need different definitions.
23  */
24
25 /**
26  * XMLPUBFUN:
27  *
28  * Macros which declare an exportable function
29  */
30 #define XMLPUBFUN
31 /**
32  * XMLPUBVAR:
33  *
34  * Macros which declare an exportable variable
35  */
36 #define XMLPUBVAR extern
37 /**
38  * XMLCALL:
39  *
40  * Macros which declare the called convention for exported functions
41  */
42 #define XMLCALL
43 /**
44  * XMLCDECL:
45  *
46  * Macro which declares the calling convention for exported functions that
47  * use '...'.
48  */
49 #define XMLCDECL
50
51 /** DOC_DISABLE */
52
53 /* Windows platform with MS compiler */
54 #if defined(_WIN32) && defined(_MSC_VER)
55   #undef XMLPUBFUN
56   #undef XMLPUBVAR
57   #undef XMLCALL
58   #undef XMLCDECL
59   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
60     #define XMLPUBFUN __declspec(dllexport)
61     #define XMLPUBVAR __declspec(dllexport)
62   #else
63     #define XMLPUBFUN
64     #if !defined(LIBXML_STATIC)
65       #define XMLPUBVAR __declspec(dllimport) extern
66     #else
67       #define XMLPUBVAR extern
68     #endif
69   #endif
70   #if defined(LIBXML_FASTCALL)
71     #define XMLCALL __fastcall
72   #else
73     #define XMLCALL __cdecl
74   #endif
75   #define XMLCDECL __cdecl
76   #if !defined _REENTRANT
77     #define _REENTRANT
78   #endif
79 #endif
80
81 /* Windows platform with Borland compiler */
82 #if defined(_WIN32) && defined(__BORLANDC__)
83   #undef XMLPUBFUN
84   #undef XMLPUBVAR
85   #undef XMLCALL
86   #undef XMLCDECL
87   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
88     #define XMLPUBFUN __declspec(dllexport)
89     #define XMLPUBVAR __declspec(dllexport) extern
90   #else
91     #define XMLPUBFUN
92     #if !defined(LIBXML_STATIC)
93       #define XMLPUBVAR __declspec(dllimport) extern
94     #else
95       #define XMLPUBVAR extern
96     #endif
97   #endif
98   #define XMLCALL __cdecl
99   #define XMLCDECL __cdecl
100   #if !defined _REENTRANT
101     #define _REENTRANT
102   #endif
103 #endif
104
105 /* Windows platform with GNU compiler (Mingw) */
106 #if defined(_WIN32) && defined(__MINGW32__)
107   #undef XMLPUBFUN
108   #undef XMLPUBVAR
109   #undef XMLCALL
110   #undef XMLCDECL
111   /*
112    * if defined(IN_LIBXML) this raises problems on mingw with msys
113    * _imp__xmlFree listed as missing. Try to workaround the problem
114    * by also making that declaration when compiling client code.
115    */
116   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
117     #define XMLPUBFUN __declspec(dllexport)
118     #define XMLPUBVAR __declspec(dllexport) extern
119   #else
120     #define XMLPUBFUN
121     #if !defined(LIBXML_STATIC)
122       #define XMLPUBVAR __declspec(dllimport) extern
123     #else
124       #define XMLPUBVAR extern
125     #endif
126   #endif
127   #define XMLCALL __cdecl
128   #define XMLCDECL __cdecl
129   #if !defined _REENTRANT
130     #define _REENTRANT
131   #endif
132 #endif
133
134 /* Cygwin platform, GNU compiler */
135 #if defined(_WIN32) && defined(__CYGWIN__)
136   #undef XMLPUBFUN
137   #undef XMLPUBVAR
138   #undef XMLCALL
139   #undef XMLCDECL
140   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
141     #define XMLPUBFUN __declspec(dllexport)
142     #define XMLPUBVAR __declspec(dllexport)
143   #else
144     #define XMLPUBFUN
145     #if !defined(LIBXML_STATIC)
146       #define XMLPUBVAR __declspec(dllimport) extern
147     #else
148       #define XMLPUBVAR
149     #endif
150   #endif
151   #define XMLCALL __cdecl
152   #define XMLCDECL __cdecl
153 #endif
154
155 /* Compatibility */
156 #if !defined(LIBXML_DLL_IMPORT)
157 #define LIBXML_DLL_IMPORT XMLPUBVAR
158 #endif
159
160 #endif /* __XML_EXPORTS_H__ */
161
162