]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: (*Proc).Call should return nil error when no error occurs
authorShenghou Ma <minux.ma@gmail.com>
Sat, 2 Feb 2013 17:42:17 +0000 (01:42 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Sat, 2 Feb 2013 17:42:17 +0000 (01:42 +0800)
Fixes #4686.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/7174047

src/pkg/syscall/dll_windows.go

index 09111ab75c8f8cfb997c4ef5eceb0f1c857cf162..d29e9921cf7eebe63af4790acfe1dca8c26c477b 100644 (file)
@@ -114,8 +114,14 @@ func (p *Proc) Addr() uintptr {
        return p.addr
 }
 
-// Call executes procedure p with arguments a.
-func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, err error) {
+// Call executes procedure p with arguments a. It will panic, if more then 15 arguments
+// are supplied.
+//
+// The returned error is always non-nil, constructed from the result of GetLastError.
+// Callers must inspect the primary return value to decide whether an error occurred
+// (according to the semantics of the specific function being called) before consulting
+// the error. The error will be guaranteed to contain syscall.Errno.
+func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
        switch len(a) {
        case 0:
                return Syscall(p.Addr(), uintptr(len(a)), 0, 0, 0)
@@ -260,8 +266,14 @@ func (p *LazyProc) Addr() uintptr {
        return p.proc.Addr()
 }
 
-// Call executes procedure p with arguments a.
-func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, err error) {
+// Call executes procedure p with arguments a. It will panic, if more then 15 arguments
+// are supplied.
+//
+// The returned error is always non-nil, constructed from the result of GetLastError.
+// Callers must inspect the primary return value to decide whether an error occurred
+// (according to the semantics of the specific function being called) before consulting
+// the error. The error will be guaranteed to contain syscall.Errno.
+func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
        p.mustFind()
        return p.proc.Call(a...)
 }