[xml] [PATCH] always dllexport the singlethreaded variables



When an application using libxml2 does not enable multithreaded support
for itself, we provide the singlethreaded variables, eventually tagged
with dllimport.  So even when we build the multithreaded libxml2, our
singlethreaded variables still eventually need the dllexport tag.
---
 include/libxml/globals.h | 165 ++++++++++++++++++++++++++++-------------------
 1 file changed, 99 insertions(+), 66 deletions(-)

diff --git a/include/libxml/globals.h b/include/libxml/globals.h
index a9305aa9..365d2a44 100644
--- a/include/libxml/globals.h
+++ b/include/libxml/globals.h
@@ -204,44 +204,49 @@ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
  */
 
 #ifdef LIBXML_THREAD_ALLOC_ENABLED
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlMallocFunc xmlMalloc;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 XMLPUBFUN  xmlMallocFunc * XMLCALL __xmlMalloc(void);
 #define xmlMalloc \
 (*(__xmlMalloc()))
-#else
-XMLPUBVAR xmlMallocFunc xmlMalloc;
 #endif
 
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 XMLPUBFUN  xmlMallocFunc * XMLCALL __xmlMallocAtomic(void);
 #define xmlMallocAtomic \
 (*(__xmlMallocAtomic()))
-#else
-XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
 #endif
 
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlReallocFunc xmlRealloc;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 XMLPUBFUN  xmlReallocFunc * XMLCALL __xmlRealloc(void);
 #define xmlRealloc \
 (*(__xmlRealloc()))
-#else
-XMLPUBVAR xmlReallocFunc xmlRealloc;
 #endif
 
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlFreeFunc xmlFree;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 XMLPUBFUN  xmlFreeFunc * XMLCALL __xmlFree(void);
 #define xmlFree \
 (*(__xmlFree()))
-#else
-XMLPUBVAR xmlFreeFunc xmlFree;
 #endif
 
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 XMLPUBFUN  xmlStrdupFunc * XMLCALL __xmlMemStrdup(void);
 #define xmlMemStrdup \
 (*(__xmlMemStrdup()))
-#else
-XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
 #endif
 
 #else /* !LIBXML_THREAD_ALLOC_ENABLED */
@@ -254,30 +259,33 @@ XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
 
 #ifdef LIBXML_DOCB_ENABLED
 XMLPUBFUN  xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define docbDefaultSAXHandler \
 (*(__docbDefaultSAXHandler()))
-#else
-XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler;
 #endif
 #endif
 
 #ifdef LIBXML_HTML_ENABLED
 XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define htmlDefaultSAXHandler \
 (*(__htmlDefaultSAXHandler()))
-#else
-XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
 #endif
 #endif
 
 XMLPUBFUN xmlError * XMLCALL __xmlLastError(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlError xmlLastError;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlLastError \
 (*(__xmlLastError()))
-#else
-XMLPUBVAR xmlError xmlLastError;
 #endif
 
 /*
@@ -288,218 +296,243 @@ XMLPUBVAR xmlError xmlLastError;
 
 
 XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int oldXMLWDcompatibility;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define oldXMLWDcompatibility \
 (*(__oldXMLWDcompatibility()))
-#else
-XMLPUBVAR int oldXMLWDcompatibility;
 #endif
 
 XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlBufferAllocScheme \
 (*(__xmlBufferAllocScheme()))
-#else
-XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
 #endif
 XMLPUBFUN xmlBufferAllocationScheme XMLCALL
        xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
 
 XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int xmlDefaultBufferSize;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDefaultBufferSize \
 (*(__xmlDefaultBufferSize()))
-#else
-XMLPUBVAR int xmlDefaultBufferSize;
 #endif
 XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v);
 
 XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDefaultSAXHandler \
 (*(__xmlDefaultSAXHandler()))
-#else
-XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
 #endif
 
 XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDefaultSAXLocator \
 (*(__xmlDefaultSAXLocator()))
-#else
-XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
 #endif
 
 XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int xmlDoValidityCheckingDefaultValue;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDoValidityCheckingDefaultValue \
 (*(__xmlDoValidityCheckingDefaultValue()))
-#else
-XMLPUBVAR int xmlDoValidityCheckingDefaultValue;
 #endif
 XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v);
 
 XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlGenericErrorFunc xmlGenericError;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlGenericError \
 (*(__xmlGenericError()))
-#else
-XMLPUBVAR xmlGenericErrorFunc xmlGenericError;
 #endif
 
 XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlStructuredError \
 (*(__xmlStructuredError()))
-#else
-XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError;
 #endif
 
 XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR void * xmlGenericErrorContext;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlGenericErrorContext \
 (*(__xmlGenericErrorContext()))
-#else
-XMLPUBVAR void * xmlGenericErrorContext;
 #endif
 
 XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR void * xmlStructuredErrorContext;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlStructuredErrorContext \
 (*(__xmlStructuredErrorContext()))
-#else
-XMLPUBVAR void * xmlStructuredErrorContext;
 #endif
 
 XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int xmlGetWarningsDefaultValue;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlGetWarningsDefaultValue \
 (*(__xmlGetWarningsDefaultValue()))
-#else
-XMLPUBVAR int xmlGetWarningsDefaultValue;
 #endif
 XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v);
 
 XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int xmlIndentTreeOutput;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlIndentTreeOutput \
 (*(__xmlIndentTreeOutput()))
-#else
-XMLPUBVAR int xmlIndentTreeOutput;
 #endif
 XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v);
 
 XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR const char * xmlTreeIndentString;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlTreeIndentString \
 (*(__xmlTreeIndentString()))
-#else
-XMLPUBVAR const char * xmlTreeIndentString;
 #endif
 XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v);
 
 XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int xmlKeepBlanksDefaultValue;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlKeepBlanksDefaultValue \
 (*(__xmlKeepBlanksDefaultValue()))
-#else
-XMLPUBVAR int xmlKeepBlanksDefaultValue;
 #endif
 XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v);
 
 XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int xmlLineNumbersDefaultValue;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlLineNumbersDefaultValue \
 (*(__xmlLineNumbersDefaultValue()))
-#else
-XMLPUBVAR int xmlLineNumbersDefaultValue;
 #endif
 XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v);
 
 XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int xmlLoadExtDtdDefaultValue;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlLoadExtDtdDefaultValue \
 (*(__xmlLoadExtDtdDefaultValue()))
-#else
-XMLPUBVAR int xmlLoadExtDtdDefaultValue;
 #endif
 XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v);
 
 XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int xmlParserDebugEntities;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlParserDebugEntities \
 (*(__xmlParserDebugEntities()))
-#else
-XMLPUBVAR int xmlParserDebugEntities;
 #endif
 XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v);
 
 XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR const char * xmlParserVersion;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlParserVersion \
 (*(__xmlParserVersion()))
-#else
-XMLPUBVAR const char * xmlParserVersion;
 #endif
 
 XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int xmlPedanticParserDefaultValue;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlPedanticParserDefaultValue \
 (*(__xmlPedanticParserDefaultValue()))
-#else
-XMLPUBVAR int xmlPedanticParserDefaultValue;
 #endif
 XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v);
 
 XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int xmlSaveNoEmptyTags;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlSaveNoEmptyTags \
 (*(__xmlSaveNoEmptyTags()))
-#else
-XMLPUBVAR int xmlSaveNoEmptyTags;
 #endif
 XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v);
 
 XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlSubstituteEntitiesDefaultValue \
 (*(__xmlSubstituteEntitiesDefaultValue()))
-#else
-XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
 #endif
 XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v);
 
 XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlRegisterNodeDefaultValue \
 (*(__xmlRegisterNodeDefaultValue()))
-#else
-XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
 #endif
 
 XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDeregisterNodeDefaultValue \
 (*(__xmlDeregisterNodeDefaultValue()))
-#else
-XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
 #endif
 
 XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \
                                __xmlParserInputBufferCreateFilenameValue(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlParserInputBufferCreateFilenameValue \
 (*(__xmlParserInputBufferCreateFilenameValue()))
-#else
-XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
 #endif
 
 XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void);
+#if !defined(LIBXML_THREAD_ENABLED) || defined(IN_LIBXML)
+XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
+#endif
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlOutputBufferCreateFilenameValue \
 (*(__xmlOutputBufferCreateFilenameValue()))
-#else
-XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
 #endif
 
 #ifdef __cplusplus
-- 
2.16.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]