aboutsummaryrefslogtreecommitdiff
path: root/src/win32_compatibility.h
diff options
context:
space:
mode:
authorDavid <david@xagasoft.com>2008-10-27 16:07:50 +0000
committerDavid <david@xagasoft.com>2008-10-27 16:07:50 +0000
commit61edfe804eb1a1dbf96fcdf2f1b700ed1cfa7ff9 (patch)
tree530a0d86ca1043dbc04cd7513bc5dd65768a266d /src/win32_compatibility.h
parentf7e8658f2274044bb452492b1af7e2cd5f82082c (diff)
downloadlibbu++-61edfe804eb1a1dbf96fcdf2f1b700ed1cfa7ff9.tar.gz
libbu++-61edfe804eb1a1dbf96fcdf2f1b700ed1cfa7ff9.tar.bz2
libbu++-61edfe804eb1a1dbf96fcdf2f1b700ed1cfa7ff9.tar.xz
libbu++-61edfe804eb1a1dbf96fcdf2f1b700ed1cfa7ff9.zip
david - apparently windows prefers to dynamically load winsock and a couple other libraries, so I got it all compiling and working in windows, yay!... I tried to minimize the impact on the code: I made a DYNLOAD macro that evaluates to nothing on everything else, but runs the dynamic code if compiled for windows... also, apparently I had been randomly switching between ifdef and ifndef WIN32: so i made most of them ifdefs so it was less confusing...
Diffstat (limited to 'src/win32_compatibility.h')
-rw-r--r--src/win32_compatibility.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/win32_compatibility.h b/src/win32_compatibility.h
index a1b9c97..7d1f79b 100644
--- a/src/win32_compatibility.h
+++ b/src/win32_compatibility.h
@@ -9,6 +9,15 @@
9#define WIN32_COMPATIBILITY__H 9#define WIN32_COMPATIBILITY__H
10 10
11#ifdef WIN32 11#ifdef WIN32
12 #define DYNLOAD DynamicWinsock2::
13#else
14 #define DYNLOAD
15#endif
16
17#ifdef WIN32
18
19#include <Winsock2.h>
20#include "fstring.h"
12 21
13#ifndef TEMP_FAILURE_RETRY 22#ifndef TEMP_FAILURE_RETRY
14#define TEMP_FAILURE_RETRY(expression) \ 23#define TEMP_FAILURE_RETRY(expression) \
@@ -19,9 +28,31 @@
19 __result; })) 28 __result; }))
20#endif 29#endif
21 30
22//__extension__ typedef unsigned int socklen_t;
23__extension__ typedef int socklen_t; 31__extension__ typedef int socklen_t;
24 32
33namespace DynamicWinsock2
34{
35 void inet_ntoa( Bu::FString &out, struct in_addr addr_in );
36 unsigned long inet_addr( const char *s_in );
37 int select(int nfds, fd_set *readfds, fd_set *writefds,
38 fd_set *exceptfds, const struct timeval *timeout);
39 SOCKET socket(int domain, int type, int protocol);
40 int ioctlsocket(SOCKET s, long cmd, u_long *argp);
41 u_short htons(u_short in);
42 u_long htonl(u_long in);
43 struct hostent *gethostbyname(const char *name);
44 int connect(SOCKET s, const struct sockaddr *serv_addr, int addrlen);
45 int getpeername(SOCKET s, struct sockaddr *name, int *namelen);
46 int setsockopt(SOCKET s, int level, int optname,
47 const char *optval, int optlen);
48 int bind(SOCKET s, const struct sockaddr *my_addr, int addrlen);
49 int listen(SOCKET s, int backlog);
50 SOCKET accept(SOCKET s, struct sockaddr *addr, int *addrlen);
51 int recv( SOCKET s, char *buf, int len, int flags );
52 int send( SOCKET s, const char *buf, int len, int flags );
53 int DYN_FD_ISSET(SOCKET s, fd_set *set);
54};
55
25#endif /* WIN32 */ 56#endif /* WIN32 */
26#endif 57#endif
27 58