-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: mkwinsyscall: Add support for DLLs with extensions other than .dll #58337
Comments
The downside of the proposed solution is that if the DLL name itself has a dot (for example, |
(CC @golang/windows) |
Anything else that I can provide here, team? |
The proposed solution enters in conflict with what has been implemented in #57913 to support DLL names with For example, if I had to use the method
Which would generate this: modprinter_drv = windows.NewLazySystemDLL("printer.drv.dll")
procClosePrinter = modprinter_drv.NewProc("ClosePrinter") With your solution, it could incorrectly generate the following: modprinter = windows.NewLazySystemDLL("printer.drv")
procClosePrinter = modprinter.NewProc("ClosePrinter") In summary, I would avoid overloading the DLL name in the
|
Yeah, removing ambiguity makes the most sense to me, and I feel like I should have explored that more rather than escaping //sysimport windowsnetworking "windows.networking.dll"
//sys SetSocketMediaStreamingMode(...) (...) = windowsnetworking.SetSocketMediaStreamingMode
//sysimport winspool "winspool.drv"
//sys ClosePrinter(h syscall.Handle) (err error) = winspool.ClosePrinter Adding |
Agreed, a new optional parameter like [ext=drv] sounds like a good way to handle exceptions like these. I'll create a pull request. |
Agreed. It is unfortunate to complicate things, but I don't see any other way to solve this problem. Hopefully there are not many dll files with not dll extension, so this scenario will be pretty rare. Alex |
This pull request addresses the above issue. |
Replied at https://go-review.googlesource.com/c/sys/+/506697 Alex |
@alexbrainman, thanks for the code review comments. It's been a while, and I didn't follow the contributor guidelines properly earlier (for example, I didn't use the git codereview tool). |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Some of the Windows system dynamic link library (DLL) files have extensions other than
.dll
.For example,
.ocx
extension.cpl
extension.drv
extensionmkwinsyscall does not support generating the syscall wrappers for these DLLs with different extensions.
The extension is always hard-coded to
.dll
in the generated code.What did you expect to see?
What did you see instead?
Proposed solution
If the user specified the extension of the DLL in the
//sys
comment, use that extension instead of adding the.dll
extension.Going back to the previous example, the user can specify the extension as
.drv
in the//sys
comment.Then, the generated code will be,
The code changes are fairly straightforward. I have working code that I can submit as a pull request if the proposal makes sense.
The text was updated successfully, but these errors were encountered: