[io-layer] Extract file (#4255)
[mono.git] / mono / io-layer / io-layer.h
1 /*
2  * io-layer.h: Include the right files depending on platform.  This
3  * file is the only entry point into the io-layer library.
4  *
5  * Author:
6  *      Dick Porter (dick@ximian.com)
7  *
8  * (C) 2002 Ximian, Inc.
9  */
10
11 #ifndef _MONO_IOLAYER_IOLAYER_H_
12 #define _MONO_IOLAYER_IOLAYER_H_
13
14 #include <config.h>
15 #include <glib.h>
16
17 #if defined(__WIN32__) || defined(_WIN32)
18 /* Native win32 */
19 #define __USE_W32_SOCKETS
20 #include <winsock2.h>
21 #include <windows.h>
22 #include <winbase.h>
23 /*
24  * The mingw version says:
25  * /usr/i686-pc-mingw32/sys-root/mingw/include/ws2tcpip.h:38:2: error: #error "ws2tcpip.h is not compatible with winsock.h. Include winsock2.h instead."
26  */
27 #ifdef _MSC_VER
28 #include <ws2tcpip.h>
29 #endif
30 #include <psapi.h>
31
32  /*
33  * Workaround for missing WSAPOLLFD typedef in mingw's winsock2.h that is required for mswsock.h below.
34  * Remove once http://sourceforge.net/p/mingw/bugs/1980/ is fixed.
35  */
36 #if defined(__MINGW_MAJOR_VERSION) && __MINGW_MAJOR_VERSION == 4 
37 typedef struct pollfd {
38   SOCKET fd;
39   short  events;
40   short  revents;
41 } WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
42 #endif
43
44 #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
45 #include <mswsock.h>
46 #endif
47
48 #else   /* EVERYONE ELSE */
49 #include "mono/io-layer/wapi.h"
50 #endif /* HOST_WIN32 */
51
52 #ifdef __native_client__
53 #include "mono/metadata/nacl-stub.h"
54 #endif
55
56 #endif /* _MONO_IOLAYER_IOLAYER_H_ */