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
x/sys/windows: NewCallback function does not work #21831
Comments
@jeetp96 I don't think golang.org/x/sys/windows.NewCallback ever worked. Did it ever? I think we should just delete golang.org/x/sys/windows.NewCallback. What do you think, @ianlancetaylor? Alex |
@alexbrainman This is the first time I'm using golang.org/x/sys/windows.NewCallback, so I don't know if it ever worked earlier. https://golang.org/pkg/syscall/ says to migrate to golang.org/x/sys, and that's what I was trying to do. Now that you suggest deleting golang.org/x/sys/windows.NewCallback, and because it's suggested to migrate to golang.org/x/sys, I would like to propose something. Would it be possible to call syscall.NewCallback from golang.org/x/sys/windows.NewCallback and return that as a result? golang.org/x/sys already imports syscall. By doing what I proposed, developers using golang.org/x/sys would not have to import syscall just for the NewCallback function. |
I'm sorry for that closing and reopening - in the comment box, I thought "Close and comment" meant close the preview and comment. |
Yes, that should, probably, work. Would you like to try and fix it yourself? This https://golang.org/doc/contribute.html is how to contribute. Alex |
I would love to try and fix it. I'll read the guidelines and start working on it. |
@alexbrainman, I noticed there is a I could fix the
What do you suggest? |
Correct. syscall.NewCallback(f) can panic if f is not acceptable function. It was, probably, a mistake to panic instead of returning error from syscall.NewCallback, but it cannot be changed now.
I would go for option 2. For consistency sake. Alex |
Change https://golang.org/cl/63230 mentions this issue: |
Change https://golang.org/cl/63250 mentions this issue: |
What version of Go are you using (
go version
)?go1.9 windows/amd64
on Windows8.1
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOARCH=amd64
GOHOSTARCH=amd64
GOHOSTOS=windows
GOOS=windows
What did you do?
What did you expect to see?
NewCallback
function in x/sys/windows working correctly as in syscallWhat did you see instead?
The text was updated successfully, but these errors were encountered: