w32
w32 copied to clipboard
failed install on Windows 10 Home 64 bit
when running go install it returns with
.\user32.go:1039:10: cannot use flag (type uint32) as type uintptr in argument to procRedrawWindow.Call
I have the same problem on go version go1.10.2 windows/amd64. Build is broken.
To be compatible with 64-bit go, line 1040 of user32.go probably needs to be changed from
flag,
to
uintptr(flag),
I changed it in my local copy and the compile error went away and the package built without any problems. I don't use RedrawWindow though so I don't know if the function breaks. And my knowledge of the syscall package is pretty much nonexistent so I can't be 100% sure this change is correct.
Working version (https://github.com/jessehager correction): go get github.com/TheTitanrain/w32
Does the unintptr(flag)
fix also work for 32-bit systems, as well as non-Home editions of Windows?
Yes, uintptr
is an integer type of the same size as whatever the underlying pointer size is. On 64-bit systems it is 64 bits. On 32-bit systems it is 32 bits. For the windows api C/C++ compilers perform integer to uintptr_t conversions automatically. In the api wrapper uintptr
is not mapped to one of Go's underlying integer types, but treated as an opaque type. So Go's type system requires an explicit conversion in this case.
I have an actively maintained fork which I use to create both 32 and 64 bit applications, both for work and for private projects. It has diverged quite a bit from this original fork. You could give it a try instead:
https://github.com/gonutz/w32