From f695bb0b6f2447093696c837f92936b77fb6f60d Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 23 Oct 2013 18:30:03 +0100 Subject: Fixed socket compilation problems on Windows. --- lib/windows/winlean.nim | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/windows') diff --git a/lib/windows/winlean.nim b/lib/windows/winlean.nim index 6f72319ba..42571b789 100644 --- a/lib/windows/winlean.nim +++ b/lib/windows/winlean.nim @@ -334,6 +334,13 @@ const proc WSAGetLastError*(): cint {.importc: "WSAGetLastError", dynlib: ws2dll.} +when hostCPU == "amd64": + type + TSocketHandle* = distinct int # on WIN64 `SOCKET` is UINT_PTR +else: + type + TSocketHandle* = distinct cuint # on WIN32 `SOCKET` is U_INT (unsigned int) + type TWSAData* {.pure, final, importc: "WSADATA", header: "Winsock2.h".} = object wVersion, wHighVersion: int16 @@ -409,16 +416,9 @@ type Tsocklen* = cuint -when hostCPU == "amd64": - type - TSocketHandle* = distinct int # on WIN64 `SOCKET` is UINT_PTR -else: - type - TSocketHandle* = distinct cuint # on WIN32 `SOCKET` is U_INT (unsigned int) - var SOMAXCONN* {.importc, header: "Winsock2.h".}: cint - INVALID_SOCKET* {.importc, header: "Winsock2.h".}: cint + INVALID_SOCKET* {.importc, header: "Winsock2.h".}: TSocketHandle proc `==`*(x, y: TSocketHandle): bool {.borrow.} -- cgit 1.4.1-2-gfad0