applied a patch from Marcus Boerger to fix problems with calling

* error.c globals.c parser.c runtest.c testHTML.c testSAX.c
  threads.c valid.c xmllint.c xmlreader.c xmlschemas.c xmlstring.c
  xmlwriter.c include/libxml/parser.h include/libxml/relaxng.h
  include/libxml/valid.h include/libxml/xmlIO.h
  include/libxml/xmlerror.h include/libxml/xmlexports.h
  include/libxml/xmlschemas.h: applied a patch from Marcus Boerger
  to fix problems with calling conventions on Windows this should
  fix #309757
Daniel
diff --git a/ChangeLog b/ChangeLog
index 4eab96b..d00ebfc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Thu Jul 21 09:21:00 EDT 2005 Daniel Veillard <daniel@veillard.com>
+
+	* error.c globals.c parser.c runtest.c testHTML.c testSAX.c
+	  threads.c valid.c xmllint.c xmlreader.c xmlschemas.c xmlstring.c
+	  xmlwriter.c include/libxml/parser.h include/libxml/relaxng.h
+	  include/libxml/valid.h include/libxml/xmlIO.h
+	  include/libxml/xmlerror.h include/libxml/xmlexports.h
+	  include/libxml/xmlschemas.h: applied a patch from Marcus Boerger
+	  to fix problems with calling conventions on Windows this should
+	  fix #309757
+
 Wed Jul 20 14:45:39 CEST 2005 Daniel Veillard <daniel@veillard.com>
 
 	* parser.c: an optimization of the char data inner loop,
diff --git a/error.c b/error.c
index b0d0f14..7053686 100644
--- a/error.c
+++ b/error.c
@@ -16,7 +16,7 @@
 #include <libxml/xmlmemory.h>
 #include <libxml/globals.h>
 
-void xmlGenericErrorDefaultFunc	(void *ctx ATTRIBUTE_UNUSED,
+void XMLCDECL xmlGenericErrorDefaultFunc	(void *ctx ATTRIBUTE_UNUSED,
 				 const char *msg,
 				 ...);
 
@@ -62,7 +62,7 @@
  * 
  * Default handler for out of context error messages.
  */
-void
+void XMLCDECL
 xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
     va_list args;
 
@@ -437,7 +437,7 @@
  * then forward the error message down the parser or generic
  * error callback handler
  */
-void
+void XMLCDECL
 __xmlRaiseError(xmlStructuredErrorFunc schannel,
               xmlGenericErrorFunc channel, void *data, void *ctx,
               void *nod, int domain, int code, xmlErrorLevel level,
@@ -657,7 +657,7 @@
  * Display and format an error messages, gives file, line, position and
  * extra parameters.
  */
-void
+void XMLCDECL
 xmlParserError(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -700,7 +700,7 @@
  * Display and format a warning messages, gives file, line, position and
  * extra parameters.
  */
-void
+void XMLCDECL
 xmlParserWarning(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -749,7 +749,7 @@
  * Display and format an validity error messages, gives file,
  * line, position and extra parameters.
  */
-void
+void XMLCDECL
 xmlParserValidityError(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -793,7 +793,7 @@
  * Display and format a validity warning messages, gives file, line,
  * position and extra parameters.
  */
-void
+void XMLCDECL
 xmlParserValidityWarning(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
diff --git a/globals.c b/globals.c
index e4e4e4e..bee542c 100644
--- a/globals.c
+++ b/globals.c
@@ -289,7 +289,7 @@
 
 /* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
 /* Must initialize xmlGenericError in xmlInitParser */
-void xmlGenericErrorDefaultFunc	(void *ctx ATTRIBUTE_UNUSED,
+void XMLCDECL xmlGenericErrorDefaultFunc	(void *ctx ATTRIBUTE_UNUSED,
 				 const char *msg,
 				 ...);
 /**
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index 7203ca3..6e750e7 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -591,7 +591,7 @@
  * 
  * Display and format a warning messages, callback.
  */
-typedef void (*warningSAXFunc) (void *ctx,
+typedef void (XMLCDECL *warningSAXFunc) (void *ctx,
 				const char *msg, ...);
 /**
  * errorSAXFunc:
@@ -601,7 +601,7 @@
  * 
  * Display and format an error messages, callback.
  */
-typedef void (*errorSAXFunc) (void *ctx,
+typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
 				const char *msg, ...);
 /**
  * fatalErrorSAXFunc:
@@ -613,7 +613,7 @@
  * Note: so far fatalError() SAX callbacks are not used, error()
  *       get all the callbacks for errors.
  */
-typedef void (*fatalErrorSAXFunc) (void *ctx,
+typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx,
 				const char *msg, ...);
 /**
  * isStandaloneSAXFunc:
diff --git a/include/libxml/relaxng.h b/include/libxml/relaxng.h
index cd75398..c75aba2 100644
--- a/include/libxml/relaxng.h
+++ b/include/libxml/relaxng.h
@@ -27,8 +27,8 @@
 /**
  * A schemas validation context
  */
-typedef void (*xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...);
-typedef void (*xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...);
+typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...);
+typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...);
 
 typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt;
 typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr;
diff --git a/include/libxml/valid.h b/include/libxml/valid.h
index 86e3fce..d13e4eb 100644
--- a/include/libxml/valid.h
+++ b/include/libxml/valid.h
@@ -39,7 +39,7 @@
  * Callback called when a validity error is found. This is a message
  * oriented function similar to an *printf function.
  */
-typedef void (*xmlValidityErrorFunc) (void *ctx,
+typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx,
 			     const char *msg,
 			     ...);
 
@@ -54,7 +54,7 @@
  * Callback called when a validity warning is found. This is a message
  * oriented function similar to an *printf function.
  */
-typedef void (*xmlValidityWarningFunc) (void *ctx,
+typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx,
 			       const char *msg,
 			       ...);
 
diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h
index 0f7b8a8..e67b6e5 100644
--- a/include/libxml/xmlIO.h
+++ b/include/libxml/xmlIO.h
@@ -31,7 +31,7 @@
  *
  * Returns 1 if yes and 0 if another Input module should be used
  */
-typedef int (*xmlInputMatchCallback) (char const *filename);
+typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename);
 /**
  * xmlInputOpenCallback:
  * @filename: the filename or URI
@@ -40,7 +40,7 @@
  *
  * Returns an Input context or NULL in case or error
  */
-typedef void * (*xmlInputOpenCallback) (char const *filename);
+typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename);
 /**
  * xmlInputReadCallback:
  * @context:  an Input context
@@ -51,7 +51,7 @@
  *
  * Returns the number of bytes read or -1 in case of error
  */
-typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
+typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len);
 /**
  * xmlInputCloseCallback:
  * @context:  an Input context
@@ -60,7 +60,7 @@
  *
  * Returns 0 or -1 in case of error
  */
-typedef int (*xmlInputCloseCallback) (void * context);
+typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
 
 #ifdef LIBXML_OUTPUT_ENABLED
 /*
@@ -77,7 +77,7 @@
  *
  * Returns 1 if yes and 0 if another Output module should be used
  */
-typedef int (*xmlOutputMatchCallback) (char const *filename);
+typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename);
 /**
  * xmlOutputOpenCallback:
  * @filename: the filename or URI
@@ -86,7 +86,7 @@
  *
  * Returns an Output context or NULL in case or error
  */
-typedef void * (*xmlOutputOpenCallback) (char const *filename);
+typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename);
 /**
  * xmlOutputWriteCallback:
  * @context:  an Output context
@@ -97,7 +97,7 @@
  *
  * Returns the number of bytes written or -1 in case of error
  */
-typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
+typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer,
                                        int len);
 /**
  * xmlOutputCloseCallback:
@@ -107,7 +107,7 @@
  *
  * Returns 0 or -1 in case of error
  */
-typedef int (*xmlOutputCloseCallback) (void * context);
+typedef int (XMLCALL *xmlOutputCloseCallback) (void * context);
 #endif /* LIBXML_OUTPUT_ENABLED */
 
 #ifdef __cplusplus
diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h
index 04da1a6..1d02829 100644
--- a/include/libxml/xmlerror.h
+++ b/include/libxml/xmlerror.h
@@ -815,7 +815,7 @@
  * Signature of the function to use when there is an error and
  * no parsing or validity context available .
  */
-typedef void (*xmlGenericErrorFunc) (void *ctx,
+typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx,
 				 const char *msg,
 	 			 ...);
 /**
@@ -826,7 +826,7 @@
  * Signature of the function to use when there is an error and
  * the module handles the new error reporting mechanism.
  */
-typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
+typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
 
 /*
  * Use the following function to reset the two global variables
@@ -845,19 +845,19 @@
  * Default message routines used by SAX and Valid context for error
  * and warning reporting.
  */
-XMLPUBFUN void XMLCALL	
+XMLPUBFUN void XMLCDECL	
     xmlParserError		(void *ctx,
 				 const char *msg,
 				 ...);
-XMLPUBFUN void XMLCALL	
+XMLPUBFUN void XMLCDECL	
     xmlParserWarning		(void *ctx,
 				 const char *msg,
 				 ...);
-XMLPUBFUN void XMLCALL	
+XMLPUBFUN void XMLCDECL	
     xmlParserValidityError	(void *ctx,
 				 const char *msg,
 				 ...);
-XMLPUBFUN void XMLCALL	
+XMLPUBFUN void XMLCDECL	
     xmlParserValidityWarning	(void *ctx,
 				 const char *msg,
 				 ...);
diff --git a/include/libxml/xmlexports.h b/include/libxml/xmlexports.h
index ee03cad..500f195 100644
--- a/include/libxml/xmlexports.h
+++ b/include/libxml/xmlexports.h
@@ -40,6 +40,13 @@
  * Macros which declare the called convention for exported functions
  */
 #define XMLCALL
+/**
+ * XMLCALL:
+ *
+ * Macro which declares the calling convention for exported functions that 
+ * use '...'.
+ */
+#define XMLCDECL
 
 /** DOC_DISABLE */
 
@@ -48,6 +55,7 @@
   #undef XMLPUBFUN
   #undef XMLPUBVAR
   #undef XMLCALL
+  #undef XMLCDECL
   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
     #define XMLPUBFUN __declspec(dllexport)
     #define XMLPUBVAR __declspec(dllexport)
@@ -59,7 +67,12 @@
       #define XMLPUBVAR extern
     #endif
   #endif
-  #define XMLCALL __cdecl
+  #if defined(LIBXML_FASTCALL)
+    #define XMLCALL __fastcall
+  #else
+    #define XMLCALL __cdecl
+  #endif
+  #define XMLCDECL __cdecl
   #if !defined _REENTRANT
     #define _REENTRANT
   #endif
@@ -70,6 +83,7 @@
   #undef XMLPUBFUN
   #undef XMLPUBVAR
   #undef XMLCALL
+  #undef XMLCDECL
   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
     #define XMLPUBFUN __declspec(dllexport)
     #define XMLPUBVAR __declspec(dllexport) extern
@@ -82,6 +96,7 @@
     #endif
   #endif
   #define XMLCALL __cdecl
+  #define XMLCDECL __cdecl
   #if !defined _REENTRANT
     #define _REENTRANT
   #endif
@@ -92,6 +107,7 @@
   #undef XMLPUBFUN
   #undef XMLPUBVAR
   #undef XMLCALL
+  #undef XMLCDECL
   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
     #define XMLPUBFUN __declspec(dllexport)
     #define XMLPUBVAR __declspec(dllexport)
@@ -104,6 +120,7 @@
     #endif
   #endif
   #define XMLCALL __cdecl
+  #define XMLCDECL __cdecl
   #if !defined _REENTRANT
     #define _REENTRANT
   #endif
@@ -114,6 +131,7 @@
   #undef XMLPUBFUN
   #undef XMLPUBVAR
   #undef XMLCALL
+  #undef XMLCDECL
   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
     #define XMLPUBFUN __declspec(dllexport)
     #define XMLPUBVAR __declspec(dllexport)
@@ -126,6 +144,7 @@
     #endif
   #endif
   #define XMLCALL __cdecl
+  #define XMLCDECL __cdecl
 #endif
 
 /* Compatibility */
diff --git a/include/libxml/xmlschemas.h b/include/libxml/xmlschemas.h
index 89fc4b4..ab47091 100644
--- a/include/libxml/xmlschemas.h
+++ b/include/libxml/xmlschemas.h
@@ -87,8 +87,8 @@
 /**
  * A schemas validation context
  */
-typedef void (*xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...);
-typedef void (*xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...);
+typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...);
+typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...);
 
 typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
 typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
diff --git a/parser.c b/parser.c
index 67d5c46..13d19a0 100644
--- a/parser.c
+++ b/parser.c
@@ -12454,7 +12454,7 @@
 #include <libxml/xpath.h>
 #endif
 
-extern void xmlGenericErrorDefaultFunc(void *ctx, const char *msg, ...);
+extern void XMLCDECL xmlGenericErrorDefaultFunc(void *ctx, const char *msg, ...);
 static int xmlParserInitialized = 0;
 
 /**
diff --git a/runtest.c b/runtest.c
index 1923dc1..3ec48cb 100644
--- a/runtest.c
+++ b/runtest.c
@@ -241,7 +241,7 @@
 static char testErrors[32769];
 static int testErrorsSize = 0;
 
-static void
+static void XMLCDECL
 testErrorHandler(void *ctx  ATTRIBUTE_UNUSED, const char *msg, ...) {
     va_list args;
     int res;
@@ -263,7 +263,7 @@
     testErrors[testErrorsSize] = 0;
 }
 
-static void
+static void XMLCDECL
 channel(void *ctx  ATTRIBUTE_UNUSED, const char *msg, ...) {
     va_list args;
     int res;
@@ -1287,7 +1287,7 @@
  * Display and format a warning messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -1310,7 +1310,7 @@
  * Display and format a error messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -1333,7 +1333,7 @@
  * Display and format a fatalError messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
diff --git a/testHTML.c b/testHTML.c
index c5da07e..205bdf2 100644
--- a/testHTML.c
+++ b/testHTML.c
@@ -523,7 +523,7 @@
  * Display and format a warning messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -543,7 +543,7 @@
  * Display and format a error messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -563,7 +563,7 @@
  * Display and format a fatalError messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
diff --git a/testSAX.c b/testSAX.c
index 36fb12d..2f2921e 100644
--- a/testSAX.c
+++ b/testSAX.c
@@ -113,7 +113,7 @@
  *           message about the timing performed; format is a printf
  *           type argument
  */
-static void
+static void XMLCDECL
 endTimer(const char *fmt, ...)
 {
     long msec;
@@ -149,7 +149,7 @@
 {
     begin = clock();
 }
-static void
+static void XMLCDECL
 endTimer(const char *fmt, ...)
 {
     long msec;
@@ -178,7 +178,7 @@
      * Do nothing
      */
 }
-static void
+static void XMLCDECL
 endTimer(char *format, ...)
 {
     /*
@@ -773,7 +773,7 @@
  * Display and format a warning messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -796,7 +796,7 @@
  * Display and format a error messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -819,7 +819,7 @@
  * Display and format a fatalError messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
diff --git a/threads.c b/threads.c
index 8b42345..90a461a 100644
--- a/threads.c
+++ b/threads.c
@@ -472,7 +472,7 @@
     void *memory;
 } xmlGlobalStateCleanupHelperParams;
 
-static void xmlGlobalStateCleanupHelper (void *p)
+static void XMLCDECL xmlGlobalStateCleanupHelper (void *p)
 {
     xmlGlobalStateCleanupHelperParams *params = (xmlGlobalStateCleanupHelperParams *) p;
     WaitForSingleObject(params->thread, INFINITE);
diff --git a/valid.c b/valid.c
index ed89c6c..f4e05f6 100644
--- a/valid.c
+++ b/valid.c
@@ -6808,7 +6808,7 @@
 /*
  * Dummy function to suppress messages while we try out valid elements
  */
-static void xmlNoValidityErr(void *ctx ATTRIBUTE_UNUSED,
+static void XMLCDECL xmlNoValidityErr(void *ctx ATTRIBUTE_UNUSED,
                                 const char *msg ATTRIBUTE_UNUSED, ...) {
     return;
 }
diff --git a/xmllint.c b/xmllint.c
index 0cbc3d1..a434bbb 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -413,7 +413,7 @@
  *           message about the timing performed; format is a printf
  *           type argument
  */
-static void
+static void XMLCDECL
 endTimer(const char *fmt, ...)
 {
     long msec;
@@ -449,7 +449,7 @@
 {
     begin = clock();
 }
-static void
+static void XMLCDECL
 endTimer(const char *fmt, ...)
 {
     long msec;
@@ -478,7 +478,7 @@
      * Do nothing
      */
 }
-static void
+static void XMLCDECL
 endTimer(char *format, ...)
 {
     /*
@@ -597,7 +597,7 @@
  * Display and format an error messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 xmlHTMLError(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -634,7 +634,7 @@
  * Display and format a warning messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 xmlHTMLWarning(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -672,7 +672,7 @@
  * Display and format an validity error messages, gives file,
  * line, position and extra parameters.
  */
-static void
+static void XMLCDECL
 xmlHTMLValidityError(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -709,7 +709,7 @@
  * Display and format a validity warning messages, gives file, line,
  * position and extra parameters.
  */
-static void
+static void XMLCDECL
 xmlHTMLValidityWarning(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -1373,7 +1373,7 @@
  * Display and format a warning messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -1396,7 +1396,7 @@
  * Display and format a error messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -1419,7 +1419,7 @@
  * Display and format a fatalError messages, gives file, line, position and
  * extra parameters.
  */
-static void
+static void XMLCDECL
 fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
diff --git a/xmlreader.c b/xmlreader.c
index e8858a1..fecc547 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -3884,13 +3884,13 @@
 static char *
 xmlTextReaderBuildMessage(const char *msg, va_list ap);
 
-static void 
+static void XMLCDECL 
 xmlTextReaderValidityError(void *ctxt, const char *msg, ...);
 
-static void 
+static void XMLCDECL 
 xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...);
 
-static void xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...)
+static void XMLCDECL xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...)
 {
 	xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx;
 	char * str;
@@ -3908,7 +3908,7 @@
 	va_end(ap);
 }
 
-static void xmlTextReaderValidityWarningRelay(void *ctx, const char *msg, ...)
+static void XMLCDECL xmlTextReaderValidityWarningRelay(void *ctx, const char *msg, ...)
 {
 	xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx;
 	char * str;
@@ -4470,7 +4470,7 @@
   }
 }
 
-static void 
+static void XMLCDECL 
 xmlTextReaderError(void *ctxt, const char *msg, ...) {
     va_list ap;
 
@@ -4482,7 +4482,7 @@
 
 }
 
-static void 
+static void XMLCDECL 
 xmlTextReaderWarning(void *ctxt, const char *msg, ...) {
     va_list ap;
 
@@ -4493,7 +4493,7 @@
     va_end(ap);
 }
 
-static void 
+static void XMLCDECL 
 xmlTextReaderValidityError(void *ctxt, const char *msg, ...) {
     va_list ap;
     int len = xmlStrlen((const xmlChar *) msg);
@@ -4511,7 +4511,7 @@
     }
 }
 
-static void 
+static void XMLCDECL 
 xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...) {
     va_list ap;
     int len = xmlStrlen((const xmlChar *) msg);
diff --git a/xmlschemas.c b/xmlschemas.c
index 3948562..aa9c6e3 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -24309,7 +24309,7 @@
  * Varargs error callbacks to the user application, harder ...
  */
 
-static void
+static void XMLCDECL
 warningSplit(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...) {
     xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx;
     if ((ctxt != NULL) && (ctxt->user_sax != NULL) &&
@@ -24317,7 +24317,7 @@
 	TODO
     }
 }
-static void
+static void XMLCDECL
 errorSplit(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...) {
     xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx;
     if ((ctxt != NULL) && (ctxt->user_sax != NULL) &&
@@ -24325,7 +24325,7 @@
 	TODO
     }
 }
-static void
+static void XMLCDECL
 fatalErrorSplit(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...) {
     xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx;
     if ((ctxt != NULL) && (ctxt->user_sax != NULL) &&
diff --git a/xmlstring.c b/xmlstring.c
index d73c49c..67a20b9 100644
--- a/xmlstring.c
+++ b/xmlstring.c
@@ -533,7 +533,7 @@
  *
  * Returns the number of characters written to @buf or -1 if an error occurs.
  */
-int 
+int XMLCDECL 
 xmlStrPrintf(xmlChar *buf, int len, const xmlChar *msg, ...) {
     va_list args;
     int ret;
diff --git a/xmlwriter.c b/xmlwriter.c
index 5e537ea..6224222 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -825,7 +825,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
                                 const char *format, ...)
 {
@@ -1200,7 +1200,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, const char *format,
                             ...)
 {
@@ -1326,7 +1326,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatString(xmlTextWriterPtr writer, const char *format,
                                ...)
 {
@@ -1887,7 +1887,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
                                   const xmlChar * name, const char *format,
                                   ...)
@@ -1982,7 +1982,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
                                     const xmlChar * prefix,
                                     const xmlChar * name,
@@ -2104,7 +2104,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
                                 const xmlChar * name, const char *format,
                                 ...)
@@ -2199,7 +2199,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
                                   const xmlChar * prefix,
                                   const xmlChar * name,
@@ -2444,7 +2444,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, const xmlChar * target,
                            const char *format, ...)
 {
@@ -2653,7 +2653,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, const char *format,
                               ...)
 {
@@ -2959,7 +2959,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
                             const xmlChar * name,
                             const xmlChar * pubid,
@@ -3203,7 +3203,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
                                    const xmlChar * name,
                                    const char *format, ...)
@@ -3440,7 +3440,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
                                    const xmlChar * name,
                                    const char *format, ...)
@@ -3697,7 +3697,7 @@
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int
+int XMLCDECL
 xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
                                           int pe,
                                           const xmlChar * name,