Home | History | Annotate | Download | only in libxml
      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 (at) 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   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
    112     #define XMLPUBFUN __declspec(dllexport)
    113     #define XMLPUBVAR __declspec(dllexport)
    114   #else
    115     #define XMLPUBFUN
    116     #if !defined(LIBXML_STATIC)
    117       #define XMLPUBVAR __declspec(dllimport) extern
    118     #else
    119       #define XMLPUBVAR extern
    120     #endif
    121   #endif
    122   #define XMLCALL __cdecl
    123   #define XMLCDECL __cdecl
    124   #if !defined _REENTRANT
    125     #define _REENTRANT
    126   #endif
    127 #endif
    128 
    129 /* Cygwin platform, GNU compiler */
    130 #if defined(_WIN32) && defined(__CYGWIN__)
    131   #undef XMLPUBFUN
    132   #undef XMLPUBVAR
    133   #undef XMLCALL
    134   #undef XMLCDECL
    135   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
    136     #define XMLPUBFUN __declspec(dllexport)
    137     #define XMLPUBVAR __declspec(dllexport)
    138   #else
    139     #define XMLPUBFUN
    140     #if !defined(LIBXML_STATIC)
    141       #define XMLPUBVAR __declspec(dllimport) extern
    142     #else
    143       #define XMLPUBVAR
    144     #endif
    145   #endif
    146   #define XMLCALL __cdecl
    147   #define XMLCDECL __cdecl
    148 #endif
    149 
    150 /* Compatibility */
    151 #if !defined(LIBXML_DLL_IMPORT)
    152 #define LIBXML_DLL_IMPORT XMLPUBVAR
    153 #endif
    154 
    155 #endif /* __XML_EXPORTS_H__ */
    156 
    157 
    158