w32 icon indicating copy to clipboard operation
w32 copied to clipboard

failed install on Windows 10 Home 64 bit

Open pengo1998 opened this issue 6 years ago • 5 comments

when running go install it returns with

.\user32.go:1039:10: cannot use flag (type uint32) as type uintptr in argument to procRedrawWindow.Call

pengo1998 avatar May 02 '18 09:05 pengo1998

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.

jessehager avatar May 11 '18 17:05 jessehager

Working version (https://github.com/jessehager correction): go get github.com/TheTitanrain/w32

TheTitanrain avatar May 17 '18 00:05 TheTitanrain

Does the unintptr(flag) fix also work for 32-bit systems, as well as non-Home editions of Windows?

Aareon avatar Sep 17 '18 20:09 Aareon

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.

jessehager avatar Sep 18 '18 13:09 jessehager

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

gonutz avatar Apr 19 '20 11:04 gonutz