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

runtime: mksyscall_windows.go -systemdll flag generates code that does not build #15167

Closed
alexbrainman opened this issue Apr 7, 2016 · 6 comments
Milestone

Comments

@alexbrainman
Copy link
Member

The -systemdll flag says that it should be used if DLLs are to be loaded from Windows system dirctory. And I noticed that golang.org/x/sys/windows/registry "go generate" line does not have that flag. So I tried to add -systemdll flag:

# cd $GOPATH/src/golang.org/x/sys/windows/registry
# git diff
diff --git a/windows/registry/syscall.go b/windows/registry/syscall.go
index c8a986f..0d07a84 100644
--- a/windows/registry/syscall.go
+++ b/windows/registry/syscall.go
@@ -8,7 +8,7 @@ package registry

 import "syscall"

-//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -xsys -output zsyscall_windows.go syscall.go
+//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -xsys -systemdll -output zsyscall_windows.go syscall.go

 const (
    _REG_OPTION_NON_VOLATILE = 0
# GOOS=windows go generate
# git diff
diff --git a/windows/registry/syscall.go b/windows/registry/syscall.go
index c8a986f..0d07a84 100644
--- a/windows/registry/syscall.go
+++ b/windows/registry/syscall.go
@@ -8,7 +8,7 @@ package registry

 import "syscall"

-//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -xsys -output zsyscall_windows.go syscall.go
+//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -xsys -systemdll -output zsyscall_windows.go syscall.go

 const (
    _REG_OPTION_NON_VOLATILE = 0
diff --git a/windows/registry/zsyscall_windows.go b/windows/registry/zsyscall_windows.go
index 0fa24c6..0a2f4b6 100644
--- a/windows/registry/zsyscall_windows.go
+++ b/windows/registry/zsyscall_windows.go
@@ -4,6 +4,7 @@ package registry

 import (
    "golang.org/x/sys/windows"
+   "internal/syscall/windows/sysdll"
    "syscall"
    "unsafe"
 )
@@ -11,8 +12,8 @@ import (
 var _ unsafe.Pointer

 var (
-   modadvapi32 = windows.NewLazySystemDLL("advapi32.dll")
-   modkernel32 = windows.NewLazySystemDLL("kernel32.dll")
+   modadvapi32 = windows.NewLazySystemDLL(sysdll.Add("advapi32.dll"))
+   modkernel32 = windows.NewLazySystemDLL(sysdll.Add("kernel32.dll"))

    procRegCreateKeyExW           = modadvapi32.NewProc("RegCreateKeyExW")
    procRegDeleteKeyW             = modadvapi32.NewProc("RegDeleteKeyW")
# GOOS=windows go build
package golang.org/x/sys/windows/registry
        imports internal/syscall/windows/sysdll: use of internal package not allowed
#

But without success.

Alex

@gopherbot
Copy link

CL https://golang.org/cl/21645 mentions this issue.

@bradfitz bradfitz added this to the Unreleased milestone Apr 7, 2016
@bradfitz
Copy link
Contributor

bradfitz commented Apr 8, 2016

I don't think it's worth changing. I think it's fixable with documentation on the existing flags instead.

@alexbrainman
Copy link
Member Author

I think it's fixable with documentation on the existing flags instead.

Be my guest.

Alex

@alexbrainman
Copy link
Member Author

Should we fix this before you're away? My CL 21645 still stands.

Alex

PS: I will be traveling until mid June too.

@bradfitz bradfitz modified the milestones: Go1.7, Unreleased May 10, 2016
gopherbot pushed a commit that referenced this issue May 11, 2016
Also run "go generate" in
internal/syscall/windows and internal/syscall/windows/registry

Updates #15167

Change-Id: I0109226962f81857fe11d308b869d561ea8ed9f9
Reviewed-on: https://go-review.googlesource.com/23021
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/23022 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/23023 mentions this issue.

gopherbot pushed a commit that referenced this issue May 12, 2016
Updates #15167

Change-Id: I826f67e75011ba79325a1294ac0d70d7c6a3e32f
Reviewed-on: https://go-review.googlesource.com/23022
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
gopherbot pushed a commit to golang/sys that referenced this issue May 12, 2016
Updates golang/go#15167

Change-Id: I58bd7e4e6ba88a2ffba11506e5ac0495de303b5b
Reviewed-on: https://go-review.googlesource.com/23023
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
@golang golang locked and limited conversation to collaborators May 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants