-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Update winlean.nim, import AddrInfo
from ws2tcpip.h
#24828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -437,7 +437,7 @@ type | |||
fd_count*: cint # unsigned | |||
fd_array*: array[0..FD_SETSIZE-1, SocketHandle] | |||
|
|||
AddrInfo* = object | |||
AddrInfo* {.importc: "ADDRINFOA", header: "ws2tcpip.h".} = object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASCII structure in 2025, you joking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ADDRINFOA is applicable to getaddrinfo. If you want ADDRINFOW, then you should use GetAddrInfoW.
Currently, the Nim standard library uses getaddrinfo, and the GetAddrInfoW function is not imported. Users may need to import it themselves.
Lines 571 to 576 in 10c9eba
proc getaddrinfo*(nodename, servname: cstring, hints: ptr AddrInfo, | |
res: var ptr AddrInfo): cint {. | |
stdcall, importc: "getaddrinfo", dynlib: ws2dll.} | |
proc freeAddrInfo*(ai: ptr AddrInfo) {. | |
stdcall, importc: "freeaddrinfo", dynlib: ws2dll.} |
What the reason to make it dependent on |
When you attempt to work with other C network libraries, the C compiler will complain about type inconsistencies.·
On Windows, Nim doesn't map the According to the Microsoft documentation,
I noticed that the documentation mentions:
According to the documentation's suggestion, I should probably include |
Thanks for your hard work on this PR! Hint: mm: orc; opt: speed; options: -d:release |
[ADDRINFOA](https://learn.microsoft.com/en-us/windows/win32/api/ws2def/ns-ws2def-addrinfoa#remarks). (cherry picked from commit b961ee6)
ADDRINFOA.
It's unclear whether this modification will break other users' code.