-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Winlean definition issues #12327
Comments
Build is currently failing, need to work through all definitions to check them
Edited: # posix.nim
SockLen* {.importc: "socklen_t", header: "<sys/socket.h>".} = cuint
https://nim-lang.org/docs/winlean.html#SockLen proc accept(s: SocketHandle; a: ptr SockAddr; addrlen: ptr SockLen): SocketHandle {.
stdcall, importc: "accept", dynlib: ws2dll.} In MSDN: SOCKET WSAAPI accept(
SOCKET s,
sockaddr *addr,
int *addrlen
); Another thing which can be improved, but it's ok for me. proc getsockopt(s: SocketHandle; level, optname: cint; optval: pointer;
optlen: ptr SockLen): cint {.stdcall, importc: "getsockopt",
dynlib: ws2dll.} |
note regarding WINBOOL: WINBOOL is currently
proc closeHandleCheck(handle: Handle) {.inline.} =
if handle.closeHandle() == 0:
raiseOSError(osLastError()) links
|
# winlean
type
LONG* = int32
ULONG* = int32
PULONG* = ptr int this is not correct too! It should be type
LONG* = int32
ULONG* = cuint
PULONG* = ptr ULONG |
I’m going to try get tome this weekend to at least take a first pass at this and see how much would break. |
I'll chime in and add that Line 150 in 8ccde68
This means it's limited to roughly 2GB files because DWORD = int32 in winlean:Line 38 in 8ccde68
But DOWRD = uint32 here:Line 82 in 8ccde68
So using |
The
winlean
module has a couple type definitions that don't quite match up to Microsoft's documentation:DWORD
: defined asint32
, Microsoft documents it astypedef unsigned long DWORD;
:HANDLE
: defined asint
, Microsoft documents it astypedef PVOID HANDLE;
:There may well be others, but these are the two I've noticed so far. This is causing issues in my
serial
package.It seems the
DWORD
issue was already reported as #9848The HANDLE definition also means that the
INVALID_HANDLE_VALUE
constant doesn't work as this is defined as-1
by Microsoft, which isn't a validint
.Changing these may break things, but for the sake of correctness (and fixing my library 😉) I think it's worth investigating.
The text was updated successfully, but these errors were encountered: