winsock.h vs. unistd.h

Francois Gouget fgouget at codeweavers.com
Sun Mar 31 21:21:48 CST 2002


   This patch should fix the error one would get in Winelib applications
when including unistd.h. The trick is that winsock.h no longer defines
gethostname and that Winelib applications no longer link with the
winsock gethostname. This should have no adverse effect since winsock's
gethostname should not differ from the standard Unix gethostname from a
semantic point of vue (the only difference is the calling convention).


Changelog:

   François Gouget <fgouget at codeweavers.com>

 * include/winsock.h,
   dlls/winsock/ws2_32.spec,
   dlls/wsock32/wsock32.spec

   Fix for the unistd.h vs. winsock.h problem in Winelib applications
   Refine the WS_DEFINE_HTONL definition


-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: dlls/winsock/ws2_32.spec
===================================================================
RCS file: /home/wine/wine/dlls/winsock/ws2_32.spec,v
retrieving revision 1.15
diff -u -r1.15 ws2_32.spec
--- dlls/winsock/ws2_32.spec	14 Jan 2002 18:33:44 -0000	1.15
+++ dlls/winsock/ws2_32.spec	30 Mar 2002 19:15:25 -0000
@@ -69,7 +69,7 @@
 54  stdcall  getprotobynumber(long) WS_getprotobynumber
 55  stdcall  getservbyname(str str) WS_getservbyname
 56  stdcall  getservbyport(long str) WS_getservbyport
-57  stdcall  gethostname(ptr long) WS_gethostname
+57  stdcall  -noimport gethostname(ptr long) WS_gethostname
 58  stub     WSAJoinLeaf
 59  stub     WSALookupServiceBeginA
 60  stub     WSALookupServiceBeginW
Index: dlls/wsock32/wsock32.spec
===================================================================
RCS file: /home/wine/wine/dlls/wsock32/wsock32.spec,v
retrieving revision 1.7
diff -u -r1.7 wsock32.spec
--- dlls/wsock32/wsock32.spec	14 Nov 2001 21:26:23 -0000	1.7
+++ dlls/wsock32/wsock32.spec	30 Mar 2002 19:15:25 -0000
@@ -36,7 +36,7 @@
  54 forward getprotobynumber ws2_32.getprotobynumber
  55 forward getservbyname ws2_32.getservbyname
  56 forward getservbyport ws2_32.getservbyport
- 57 forward gethostname ws2_32.gethostname
+ 57 forward -noimport gethostname ws2_32.gethostname
 101 forward WSAAsyncSelect ws2_32.WSAAsyncSelect
 102 forward WSAAsyncGetHostByAddr ws2_32.WSAAsyncGetHostByAddr
 103 forward WSAAsyncGetHostByName ws2_32.WSAAsyncGetHostByName
Index: include/winsock.h
===================================================================
RCS file: /home/wine/wine/include/winsock.h,v
retrieving revision 1.41
diff -u -r1.41 winsock.h
--- include/winsock.h	23 Mar 2002 20:43:52 -0000	1.41
+++ include/winsock.h	30 Mar 2002 19:15:32 -0000
@@ -65,7 +65,7 @@
  * we try to define our own prototypes (different calling convention).
  */
 # include <sys/types.h>
-# ifndef htonl
+# if defined(USE_WS_PREFIX) || !defined(htonl)
 #  define WS_DEFINE_HTONL
 # endif /* htonl */
 #else
@@ -913,7 +912,7 @@
 int WINAPI WS(connect)(SOCKET,const struct WS(sockaddr)*,int);
 struct WS(hostent)* WINAPI WS(gethostbyaddr)(const char*,int,int);
 struct WS(hostent)* WINAPI WS(gethostbyname)(const char*);
-int WINAPI WS(gethostname)(char*,int);
+/* gethostname not defined because of conflicts with unistd.h */
 int WINAPI WS(getpeername)(SOCKET,struct WS(sockaddr)*,int*);
 struct WS(protoent)* WINAPI WS(getprotobyname)(const char*);
 struct WS(protoent)* WINAPI WS(getprotobynumber)(int);


More information about the wine-patches mailing list