win32.h (_Jv_platform_solib_prefix): New define.
[gcc.git] / libjava / include / win32.h
1 // win32.h -- Helper functions for Microsoft-flavored OSs.
2
3 /* Copyright (C) 2002 Free Software Foundation
4
5 This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 details. */
10
11 #ifndef __JV_WIN32_H__
12 #define __JV_WIN32_H__
13
14 #include <windows.h>
15 #undef STRICT
16
17 #undef __INSIDE_CYGWIN__
18 #include <winsock.h>
19 #define IP_TOS 3
20 #include <gcj/cni.h>
21 #include <java/util/Properties.h>
22
23 #include <io.h>
24
25 // Prefix and suffix for shared libraries.
26 #define _Jv_platform_solib_prefix ""
27 #define _Jv_platform_solib_suffix ".dll"
28
29 #ifndef DISBALE_JAVA_NET
30
31 // these errors cannot occur on Win32
32 #define ENOTCONN 0
33 #define ECONNRESET 0
34
35 #ifndef ENOPROTOOPT
36 #define ENOPROTOOPT 109
37 #endif
38
39 #endif // DISBALE_JAVA_NET
40
41 extern void _Jv_platform_initialize (void);
42 extern void _Jv_platform_initProperties (java::util::Properties*);
43 extern jlong _Jv_platform_gettimeofday ();
44
45 inline void
46 _Jv_platform_close_on_exec (jint)
47 {
48 // Ignore.
49 }
50
51 #ifndef DISBALE_JAVA_NET
52
53 static inline int
54 _Jv_socket (int domain, int type, int protocol)
55 {
56 return ::socket (domain, type, protocol);
57 }
58
59 inline int
60 _Jv_connect (jint fd, sockaddr *ptr, int len)
61 {
62 return ::connect (fd, ptr, len);
63 }
64
65 inline int
66 _Jv_close (jint fd)
67 {
68 return ::closesocket (fd);
69 }
70
71 inline int
72 _Jv_bind (int fd, struct sockaddr *addr, int addrlen)
73 {
74 return ::bind (fd, addr, addrlen);
75 }
76
77 inline int
78 _Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
79 {
80 return ::accept (fd, addr, addrlen);
81 }
82
83 inline int
84 _Jv_listen (int fd, int backlog)
85 {
86 return ::listen (fd, backlog);
87 }
88
89 inline int
90 _Jv_write(int s, void *buf, int len)
91 {
92 return ::send (s, (char*) buf, len, 0);
93 }
94
95 inline int
96 _Jv_read(int s, void *buf, int len)
97 {
98 return ::recv (s, (char*) buf, len, 0);
99 }
100
101 #endif /* DISBALE_JAVA_NET */
102
103 #define HAVE_BACKTRACE
104
105 /* Store up to SIZE return address of the current program state in
106 ARRAY and return the exact number of values stored. */
107 extern int backtrace (void **__array, int __size);
108
109 #endif /* __JV_WIN32_H__ */