From 37d3a8a8613c94e036e3e719a448ba29859f1654 Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Sun, 24 Oct 2021 10:54:46 -0400 Subject: [PATCH] fixes for windows --- vendor/ENet/enet.odin | 12 ++++++++++-- vendor/ENet/win32.odin | 18 +++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/vendor/ENet/enet.odin b/vendor/ENet/enet.odin index d71538800..b92de9aa6 100644 --- a/vendor/ENet/enet.odin +++ b/vendor/ENet/enet.odin @@ -2,9 +2,17 @@ package ENet when ODIN_OS == "windows" { when ODIN_ARCH == "amd64" { - foreign import ENet "lib/enet64.lib" + foreign import ENet { + "lib/enet64.lib", + "system:Ws2_32.lib", + "system:Winmm.lib", + } } else { - foreign import ENet "lib/enet.lib" + foreign import ENet { + "lib/enet.lib", + "system:Ws2_32.lib", + "system:Winmm.lib", + } } } else { foreign import ENet "system:enet" diff --git a/vendor/ENet/win32.odin b/vendor/ENet/win32.odin index 5f07a895f..1df35ee45 100644 --- a/vendor/ENet/win32.odin +++ b/vendor/ENet/win32.odin @@ -4,7 +4,7 @@ package ENet // When we implement the appropriate bindings for Windows, the section separated // 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") foreign WinSock2 { @@ -15,7 +15,7 @@ foreign WinSock2 { @(private="file") FD_SETSIZE :: 64 -@(private="file") fs_set :: struct { +@(private="file") fd_set :: struct { fd_count: u32, fd_array: [FD_SETSIZE]SOCKET, } @@ -44,18 +44,18 @@ foreign WinSock2 { 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 } -@(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 } // } -Socket :: distinct Socket +Socket :: distinct SOCKET -SOCKET_NULL :: Socket(~0) +SOCKET_NULL :: Socket(~uintptr(0)) Buffer :: struct { data: rawptr, @@ -69,13 +69,13 @@ SOCKETSET_EMPTY :: #force_inline proc(sockset: ^SocketSet) { } 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) { - 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 { - return FD_ISSET(i32(socket), cast(^fd_set)sockset) + return FD_ISSET(SOCKET(socket), cast(^fd_set)sockset) } \ No newline at end of file