The LIBS line was apparently accidentally deleted from configure-mingw32.
[wvstreams.git] / win32 / streams.h
blob769f0655fea8a17cd1322a2ef9ad71c0e30f643a
1 #ifndef __WIN32_STREAMS_H
2 #define __WIN32_STREAMS_H
4 #include <winsock2.h>
6 extern "C" {
7 int close(int fd);
8 int read(int fd, void *buf, size_t count);
9 int write(int fd, const void *buf, size_t count);
11 unsigned int sleep(unsigned int seconds); // does this belong here?
14 #ifndef __GNUC__
16 // this little trick allows us to define our own close/read/write
17 // (in streams.cc) that optionally call _close/_read/_write (defined in <io.h>)
18 #define __STDC__ 1 // prevents io.h from dllimporting close/read/write
20 #endif
22 #include <io.h>
24 struct socket_fd_pair
26 SOCKET socket;
27 int fd;
30 class SocketFromFDMaker
32 protected:
33 HANDLE m_hThread;
34 socket_fd_pair m_pair;
35 SOCKET m_socket;
36 bool m_wait;
37 public:
38 SocketFromFDMaker(int fd, LPTHREAD_START_ROUTINE lpt,
39 bool wait_for_termination = false);
40 ~SocketFromFDMaker();
41 SOCKET GetSocket() { return m_socket; }
44 DWORD WINAPI fd2socket_fwd(LPVOID lpThreadParameter);
45 DWORD WINAPI socket2fd_fwd(LPVOID lpThreadParameter);
47 #endif // __WIN32_STREAMS_H