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
Please answer these questions before submitting your issue. Thanks!
go version
go version go1.9.2 freebsd/amd64
yes.
go env
GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="freebsd" GOOS="freebsd" GOPATH="/home/jeff_walter/src/agent" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/freebsd_amd64" GCCGO="gccgo" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build944315930=/tmp/go-build -gno-record-gcc-switches" CXX="clang++" CGO_ENABLED="1" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config"
I ran go generate to generate syscall wrappers for some windows functions I need.
go generate
Here's my windows.go file:
package windows //go:generate go run mksyscall_windows.go -output zwindows.go windows.go import ( errorspkg "errors" "sync" "syscall" "unicode/utf16" "unsafe" ) type Handle uintptr //sys WTSQuerySessionInformation(hServer Handle, sessionId uint32, WTSInfoClass WTS_INFO_CLASS) (buffer *uintptr, bytesReturned *uint32, err error) [failretval==0] = wtsapi32.WTSQuerySessionInformationW
I expected to have a zwindows.go with my window syscall wrappers.
func WTSQuerySessionInformation(hServer syscall.Handle, sessionId uint32, WTSInfoClass WTS_INFO_CLASS) (buffer uintptr, bytesReturned uint32, err error) { r1, _, e1 := syscall.Syscall6(procWTSQuerySessionInformationW.Addr(), 5, uintptr(hServer), uintptr(sessionId), uintptr(WTSInfoClass), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(bytesReturned)), 0) if r1 == 0 { if e1 != 0 { err = errnoErr(e1) } else { err = syscall.EINVAL } } return }
go generate 2018/02/12 12:03:12 Too many return values in "WTSQuerySessionInformation(hServer syscall.Handle, sessionId uint32, WTSInfoClass WTS_INFO_CLASS) (buffer uintptr, bytesReturned uint32, err error) [failretval==0] = wtsapi32.WTSQuerySessionInformationW" exit status 1
If I change the comment to this:
//sys WTSQuerySessionInformation(hServer Handle, sessionId uint32, WTSInfoClass WTS_INFO_CLASS, buffer *uintptr, bytesReturned *uint32) (err error) [failretval==0] = wtsapi32.WTSQuerySessionInformationW
The code generation succeeds, but I get this signature:
func WTSQuerySessionInformation(hServer syscall.Handle, sessionId uint32, WTSInfoClass WTS_INFO_CLASS, buffer *uintptr, bytesReturned *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procWTSQuerySessionInformationW.Addr(), 5, uintptr(hServer), uintptr(sessionId), uintptr(WTSInfoClass), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(bytesReturned)), 0) if r1 == 0 { if e1 != 0 { err = errnoErr(e1) } else { err = syscall.EINVAL } } return }
BUT, I don't really want that as my func signature...
The text was updated successfully, but these errors were encountered:
After looking at the output further, I understand why it is this way. It would be nice if there was a better mechanism for specifying the r0 return value, instead of mapping the go function signature directly to the windows function.
Sorry, something went wrong.
No branches or pull requests
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.9.2 freebsd/amd64
Does this issue reproduce with the latest release?
yes.
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOOS="freebsd"
GOPATH="/home/jeff_walter/src/agent"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/freebsd_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build944315930=/tmp/go-build -gno-record-gcc-switches"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
What did you do?
I ran
go generate
to generate syscall wrappers for some windows functions I need.Here's my windows.go file:
What did you expect to see?
I expected to have a zwindows.go with my window syscall wrappers.
What did you see instead?
If I change the comment to this:
The code generation succeeds, but I get this signature:
BUT, I don't really want that as my func signature...
The text was updated successfully, but these errors were encountered: