Skip to content
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

failed install on Windows 10 Home 64 bit #80

Open
pengo1998 opened this issue May 2, 2018 · 5 comments
Open

failed install on Windows 10 Home 64 bit #80

pengo1998 opened this issue May 2, 2018 · 5 comments

Comments

@pengo1998
Copy link

pengo1998 commented May 2, 2018

when running go install it returns with

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

@jessehager
Copy link

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.

TheTitanrain added a commit to TheTitanrain/w32 that referenced this issue May 16, 2018
@TheTitanrain
Copy link

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

@Aareon
Copy link

Aareon commented Sep 17, 2018

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

@jessehager
Copy link

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.

@gonutz
Copy link

gonutz commented Apr 19, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants