Index: /libcaca/trunk/configure.ac
===================================================================
--- /libcaca/trunk/configure.ac	(revision 2311)
+++ /libcaca/trunk/configure.ac	(revision 2312)
@@ -335,5 +335,7 @@
     [AC_CHECK_HEADERS(inttypes.h,
       [CUCUL_TYPES=2],
-      [CUCUL_TYPES=0])])
+      [AC_CHECK_HEADERS(windows.h,
+        [CUCUL_TYPES=3],
+        [CUCUL_TYPES=0])])])
 fi
 AC_SUBST(CUCUL_TYPES)
Index: /libcaca/trunk/msvc/cucul_types.h
===================================================================
--- /libcaca/trunk/msvc/cucul_types.h	(revision 2311)
+++ /libcaca/trunk/msvc/cucul_types.h	(revision 2312)
@@ -1,2 +1,2 @@
-#define CUCUL_TYPES 0
+#define CUCUL_TYPES 3
 #include "../cucul/cucul_types.h.in"
Index: /libcaca/trunk/cucul/cucul_types.h.in
===================================================================
--- /libcaca/trunk/cucul/cucul_types.h.in	(revision 2311)
+++ /libcaca/trunk/cucul/cucul_types.h.in	(revision 2312)
@@ -34,7 +34,9 @@
 #   include <unistd.h>
 
-/* fallback: nothing is available, we assume the platform is 32-bit and
- * sizeof(long) == sizeof(void *) */
-#else
+/* mode 3: <windows.h> indicates Win32, only (u)intptr_t is present
+ * FIXME: Win64 probably doesn't work that way */
+#elif CUCUL_TYPES == 3
+#include <windows.h>
+
 typedef signed char int8_t;
 typedef signed short int16_t;
@@ -47,9 +49,50 @@
 typedef unsigned long long int uint64_t;
 
-typedef long int intptr_t;
-typedef unsigned long int uintptr_t;
-
 typedef int ssize_t;
 typedef unsigned int size_t;
+
+/* fallback: nothing is known, we assume the platform is 32-bit and
+ * sizeof(long) == sizeof(void *). We don't typedef directly because we
+ * have no idea what other typedefs have already been made. */
+#else
+typedef signed char _cucul_int8_t;
+typedef signed short _cucul_int16_t;
+typedef signed long int _cucul_int32_t;
+typedef signed long long int _cucul_int64_t;
+#   undef int8_t
+#   define int8_t _cucul_int8_t
+#   undef int16_t
+#   define int16_t _cucul_int16_t
+#   undef int32_t
+#   define int32_t _cucul_int32_t
+#   undef int64_t
+#   define int64_t _cucul_int64_t
+
+typedef unsigned char _cucul_uint8_t;
+typedef unsigned short _cucul_uint16_t;
+typedef unsigned long int _cucul_uint32_t;
+typedef unsigned long long int _cucul_uint64_t;
+#   undef uint8_t
+#   define uint8_t _cucul_uint8_t
+#   undef uint16_t
+#   define uint16_t _cucul_uint16_t
+#   undef uint32_t
+#   define uint32_t _cucul_uint32_t
+#   undef uint64_t
+#   define uint64_t _cucul_uint64_t
+
+typedef long int _cucul_intptr_t;
+typedef unsigned long int _cucul_uintptr_t;
+#   undef intptr_t
+#   define intptr_t _cucul_intptr_t
+#   undef uintptr_t
+#   define uintptr_t _cucul_uintptr_t
+
+typedef int _cucul_ssize_t;
+typedef unsigned int _cucul_size_t;
+#   undef ssize_t
+#   define ssize_t _cucul_ssize_t
+#   undef size_t
+#   define size_t _cucul_size_t
 
 #endif
