-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: break compat and use implicit mksyscall string conversion #34309
Comments
It sounds like that would change a large number of existing functions, and therefore break a large number of existing programs. We can break compatibility in x/sys/windows, but I don't think we can break it to that extent. |
It's a lot of functions, but not all are so commonly used. Here's a list:
|
I agree with Ian - let sleeping dogs lie. golang.org/x/sys/windows package started its life as copy of windows version of syscall package. And windows version of syscall package was only intended to be used by other packages in standard library. It was not intended to be used directly by any programs. If you want 'nice' interface, we should not put into golang.org/x/sys/windows package. See golang.org/x/sys/windows/registry or golang.org/x/sys/windows/svc for an example of a nice package. Alex |
x/sys/windows doesn't have a mod version, so maybe there's some leeway for breaking stuff. Here's the mischief I have in mind:
All functions that take strings in x/sys/windows take a *uint16. It's then up to the caller to do the rather cumbersome:
When you have lots of strings, this is really a drag.
As it turns out,
mksyscall.go
will automatically generate the conversion. So instead these work:Under the hood, the generated bindings do the right thing.
Now to be clear, I'm not proposing that we change mksyscall.go to generate the string conversion code. Why? Because this is already implemented!
What I am suggesting is that we change all of the definitions in x/sys/windows to take a simple
string
type instead of forcing the user to muck with *uint16. I assume that the conversion code was added to mksyscall.go for this reason, but then for some reason it never made it to x/sys/windows.cc @alexbrainman @bradfitz
The text was updated successfully, but these errors were encountered: