mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
fixes for windows
This commit is contained in:
Vendored
+10
-2
@@ -2,9 +2,17 @@ package ENet
|
|||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == "windows" {
|
||||||
when ODIN_ARCH == "amd64" {
|
when ODIN_ARCH == "amd64" {
|
||||||
foreign import ENet "lib/enet64.lib"
|
foreign import ENet {
|
||||||
|
"lib/enet64.lib",
|
||||||
|
"system:Ws2_32.lib",
|
||||||
|
"system:Winmm.lib",
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
foreign import ENet "lib/enet.lib"
|
foreign import ENet {
|
||||||
|
"lib/enet.lib",
|
||||||
|
"system:Ws2_32.lib",
|
||||||
|
"system:Winmm.lib",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreign import ENet "system:enet"
|
foreign import ENet "system:enet"
|
||||||
|
|||||||
Vendored
+9
-9
@@ -4,7 +4,7 @@ package ENet
|
|||||||
// When we implement the appropriate bindings for Windows, the section separated
|
// When we implement the appropriate bindings for Windows, the section separated
|
||||||
// by `{` and `}` here can be removed in favor of using the bindings.
|
// by `{` and `}` here can be removed in favor of using the bindings.
|
||||||
// {
|
// {
|
||||||
foreign WinSock2 import "system:Ws2_32.lib"
|
foreign import WinSock2 "system:Ws2_32.lib"
|
||||||
|
|
||||||
@(private="file", default_calling_convention="c")
|
@(private="file", default_calling_convention="c")
|
||||||
foreign WinSock2 {
|
foreign WinSock2 {
|
||||||
@@ -15,7 +15,7 @@ foreign WinSock2 {
|
|||||||
|
|
||||||
@(private="file") FD_SETSIZE :: 64
|
@(private="file") FD_SETSIZE :: 64
|
||||||
|
|
||||||
@(private="file") fs_set :: struct {
|
@(private="file") fd_set :: struct {
|
||||||
fd_count: u32,
|
fd_count: u32,
|
||||||
fd_array: [FD_SETSIZE]SOCKET,
|
fd_array: [FD_SETSIZE]SOCKET,
|
||||||
}
|
}
|
||||||
@@ -44,18 +44,18 @@ foreign WinSock2 {
|
|||||||
s.fd_count += 1
|
s.fd_count += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private="file") FD_ZERO proc #force_inline (s: ^fd_set) {
|
@(private="file") FD_ZERO :: #force_inline proc (s: ^fd_set) {
|
||||||
s.fd_count = 0
|
s.fd_count = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private="file") FD_ISSET proc #force_inline (fd: SOCKET, s: ^fd_set) -> bool {
|
@(private="file") FD_ISSET :: #force_inline proc (fd: SOCKET, s: ^fd_set) -> bool {
|
||||||
return __WSAFDIsSet(fd, s) != 0
|
return __WSAFDIsSet(fd, s) != 0
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Socket :: distinct Socket
|
Socket :: distinct SOCKET
|
||||||
|
|
||||||
SOCKET_NULL :: Socket(~0)
|
SOCKET_NULL :: Socket(~uintptr(0))
|
||||||
|
|
||||||
Buffer :: struct {
|
Buffer :: struct {
|
||||||
data: rawptr,
|
data: rawptr,
|
||||||
@@ -69,13 +69,13 @@ SOCKETSET_EMPTY :: #force_inline proc(sockset: ^SocketSet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SOCKETSET_ADD :: #force_inline proc(sockset: ^SocketSet, socket: Socket) {
|
SOCKETSET_ADD :: #force_inline proc(sockset: ^SocketSet, socket: Socket) {
|
||||||
FD_SET(i32(socket), cast(^fd_set)sockset)
|
FD_SET(SOCKET(socket), cast(^fd_set)sockset)
|
||||||
}
|
}
|
||||||
|
|
||||||
SOCKETSET_REMOVE :: #force_inline proc(sockset: ^SocketSet, socket: Socket) {
|
SOCKETSET_REMOVE :: #force_inline proc(sockset: ^SocketSet, socket: Socket) {
|
||||||
FD_CLR(i32(socket), cast(^fd_set)sockset)
|
FD_CLR(SOCKET(socket), cast(^fd_set)sockset)
|
||||||
}
|
}
|
||||||
|
|
||||||
SOCKSET_CHECK :: #force_inline proc(sockset: ^SocketSet, socket: Socket) -> bool {
|
SOCKSET_CHECK :: #force_inline proc(sockset: ^SocketSet, socket: Socket) -> bool {
|
||||||
return FD_ISSET(i32(socket), cast(^fd_set)sockset)
|
return FD_ISSET(SOCKET(socket), cast(^fd_set)sockset)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user