*use specified calling convention 
  for xmlDllMain. Old SDKs (VC6) only support InterlockedCompareExchange.
  add xmlDllMain to header for win32 when building for static dll

svn path=/trunk/; revision=3624
diff --git a/ChangeLog b/ChangeLog
index a750523..89bfbd6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Jun  8 21:37:46 CEST 2007 Rob Richards <rrichards@ctindustries.net>
+
+	* threads.c include/libxml/threads.h: use specified calling convention 
+	  for xmlDllMain. Old SDKs (VC6) only support InterlockedCompareExchange.
+	  add xmlDllMain to header for win32 when building for static dll
+
 Fri Jun  8 10:51:28 CEST 2007 Rob Richards <rrichards@ctindustries.net>
 
 	* xmlwriter.c: fixed problem with namespace declaration being 
diff --git a/include/libxml/threads.h b/include/libxml/threads.h
index 4f7d10f..f81f982 100644
--- a/include/libxml/threads.h
+++ b/include/libxml/threads.h
@@ -72,6 +72,10 @@
 XMLPUBFUN xmlGlobalStatePtr XMLCALL	
 			xmlGetGlobalState(void);
 
+#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL)
+int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/threads.c b/threads.c
index 87d0d36..0ab9e77 100644
--- a/threads.c
+++ b/threads.c
@@ -441,7 +441,11 @@
 	InitializeCriticalSection(cs);
 
 	/* Swap it into the global_init_lock */
+#ifdef InterlockedCompareExchangePointer
 	InterlockedCompareExchangePointer(&global_init_lock, cs, NULL);
+#else  /* Use older void* version */
+    InterlockedCompareExchange((void **)&global_init_lock, (void *)cs, NULL);
+#endif /* InterlockedCompareExchangePointer */
 
 	/* If another thread successfully recorded its critical
 	 * section in the global_init_lock then discard the one
@@ -912,7 +916,7 @@
  */
 #if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
 #if defined(LIBXML_STATIC_FOR_DLL)
-BOOL WINAPI xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 
+BOOL XMLCALL xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 
 #else
 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 
 #endif