aboutsummaryrefslogtreecommitdiff
path: root/src/syscall
diff options
context:
space:
mode:
authorJeet Parekh <jeetparekh96@gmail.com>2018-07-27 15:52:36 +0000
committerAustin Clements <austin@google.com>2018-07-27 17:42:58 +0000
commit05f9b369525f682020df8a55c3fc83b520575912 (patch)
tree55c222aefd8c31acb87ce14f9bf71ebf214abeb5 /src/syscall
parentead59f4bf368f13bbabea3f8a59f9f29ccdd3900 (diff)
downloadgo-05f9b369525f682020df8a55c3fc83b520575912.tar.xz
syscall: improve NewCallback documentation and panic message
Fixes #26138 Change-Id: If77b2839bccc600223735df42438a19131cd051c GitHub-Last-Rev: 64ceaea9f1cb7afb3d552dce0223b818bac1faf9 GitHub-Pull-Request: golang/go#26617 Reviewed-on: https://go-review.googlesource.com/126035 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/syscall')
-rw-r--r--src/syscall/syscall_windows.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/syscall/syscall_windows.go b/src/syscall/syscall_windows.go
index 5cfdb76e2b..b234f3d67d 100644
--- a/src/syscall/syscall_windows.go
+++ b/src/syscall/syscall_windows.go
@@ -120,16 +120,16 @@ func (e Errno) Timeout() bool {
// Implemented in runtime/syscall_windows.go.
func compileCallback(fn interface{}, cleanstack bool) uintptr
-// Converts a Go function to a function pointer conforming
-// to the stdcall calling convention. This is useful when
-// interoperating with Windows code requiring callbacks.
+// NewCallback converts a Go function to a function pointer conforming to the stdcall calling convention.
+// This is useful when interoperating with Windows code requiring callbacks.
+// The argument is expected to be a function with with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr.
func NewCallback(fn interface{}) uintptr {
return compileCallback(fn, true)
}
-// Converts a Go function to a function pointer conforming
-// to the cdecl calling convention. This is useful when
-// interoperating with Windows code requiring callbacks.
+// NewCallbackCDecl converts a Go function to a function pointer conforming to the cdecl calling convention.
+// This is useful when interoperating with Windows code requiring callbacks.
+// The argument is expected to be a function with with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr.
func NewCallbackCDecl(fn interface{}) uintptr {
return compileCallback(fn, false)
}