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 #endif 77 78 /* Windows platform with Borland compiler */ 79 #if defined(_WIN32) && defined(__BORLANDC__) 80 #undef XMLPUBFUN 81 #undef XMLPUBVAR 82 #undef XMLCALL 83 #undef XMLCDECL 84 #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) 85 #define XMLPUBFUN __declspec(dllexport) 86 #define XMLPUBVAR __declspec(dllexport) extern 87 #else 88 #define XMLPUBFUN 89 #if !defined(LIBXML_STATIC) 90 #define XMLPUBVAR __declspec(dllimport) extern 91 #else 92 #define XMLPUBVAR extern 93 #endif 94 #endif 95 #define XMLCALL __cdecl 96 #define XMLCDECL __cdecl 97 #endif 98 99 /* Windows platform with GNU compiler (Mingw) */ 100 #if defined(_WIN32) && defined(__MINGW32__) 101 #undef XMLPUBFUN 102 #undef XMLPUBVAR 103 #undef XMLCALL 104 #undef XMLCDECL 105 /* 106 * if defined(IN_LIBXML) this raises problems on mingw with msys 107 * _imp__xmlFree listed as missing. Try to workaround the problem 108 * by also making that declaration when compiling client code. 109 */ 110 #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) 111 #define XMLPUBFUN __declspec(dllexport) 112 #define XMLPUBVAR __declspec(dllexport) extern 113 #else 114 #define XMLPUBFUN 115 #if !defined(LIBXML_STATIC) 116 #define XMLPUBVAR __declspec(dllimport) extern 117 #else 118 #define XMLPUBVAR extern 119 #endif 120 #endif 121 #define XMLCALL __cdecl 122 #define XMLCDECL __cdecl 123 #endif 124 125 /* Cygwin platform (does not define _WIN32), GNU compiler */ 126 #if defined(__CYGWIN__) 127 #undef XMLPUBFUN 128 #undef XMLPUBVAR 129 #undef XMLCALL 130 #undef XMLCDECL 131 #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) 132 #define XMLPUBFUN __declspec(dllexport) 133 #define XMLPUBVAR __declspec(dllexport) 134 #else 135 #define XMLPUBFUN 136 #if !defined(LIBXML_STATIC) 137 #define XMLPUBVAR __declspec(dllimport) extern 138 #else 139 #define XMLPUBVAR extern 140 #endif 141 #endif 142 #define XMLCALL __cdecl 143 #define XMLCDECL __cdecl 144 #endif 145 146 /* Compatibility */ 147 #if !defined(LIBXML_DLL_IMPORT) 148 #define LIBXML_DLL_IMPORT XMLPUBVAR 149 #endif 150 151 #endif /* __XML_EXPORTS_H__ */ 152 153 154