MinGW, winsock.h and cross-compiling

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

 



I have tested cross-compiling the tests but hit an error in winsock.h.
The reason was that winsock.h includes sys/types.h to get the definition
of u_long and other u_xxx types, but these are not defined in MinGW.

So I modified winsock.h to detect that the types.h header came from
MinGW and to explicitly define the types ourselves if that is the case.
Just like we do for our MSVCRT headers.

The way I detect MinGW is by testing for __MINGW_H which is defined in
_mingw.h of which other headers say:

    /* All the headers include this file. */
    #include <_mingw.h>

Alternately we could test for one of the __MINGW32_VERSION macros.


Changelog:

 * include/winsock.h

   Define the u_xxx types if compiling with MinGW or with our MSVCRT
headers


Index: include/winsock.h
===================================================================
RCS file: /home/wine/wine/include/winsock.h,v
retrieving revision 1.49
diff -u -r1.49 winsock.h
--- include/winsock.h	21 Nov 2002 23:44:19 -0000	1.49
+++ include/winsock.h	12 Dec 2002 18:41:34 -0000
@@ -68,17 +68,22 @@
 # if defined(USE_WS_PREFIX) || !defined(htonl)
 #  define WS_DEFINE_HTONL
 # endif /* htonl */
+# ifdef __MINGW_H
+   /* MinGW doesn't define the u_xxx types */
+#  define WS_DEFINE_U_TYPES
+# endif
 #else
-/* Since we are using the MSVCRT headers, we must define the u_xxx
- * types ourselves.
- */
+  /* Our MSVCRT headers don't define the u_xxx types */
+# define WS_DEFINE_U_TYPES
+# define WS_DEFINE_HTONL
+#endif /* __WINE_USE_MSVCRT */
+
+#ifdef WS_DEFINE_U_TYPES
 typedef unsigned char u_char;
 typedef unsigned short u_short;
 typedef unsigned int  u_int;
 typedef unsigned long u_long;
-# define WS_DEFINE_HTONL
-#endif /* __WINE_USE_MSVCRT */
-
+#endif


 /*


-- 
Francois Gouget         fgouget@free.fr        http://fgouget.free.fr/
        War doesn't determine who's right.  War determines who's left.



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux