mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-01 14:47:28 -04:00
windows: fix NewCallback function
It has been suggested to migrate from syscall to golang.org/x/sys The NewCallback function works in syscall. But the golang.org/x/sys/windows NewCallback function did not work. Since golang.org/x/sys/windows already imports syscall, the NewCallback function now calls syscall.NewCallback. Fixes golang/go#21831 Change-Id: I5cabd8540777b398a288308a66ae20896ed4a1db Reviewed-on: https://go-review.googlesource.com/63250 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
committed by
Alex Brainman
parent
033028a6b4
commit
062cd7e4e6
@@ -71,12 +71,17 @@ func UTF16PtrFromString(s string) (*uint16, error) {
|
|||||||
|
|
||||||
func Getpagesize() int { return 4096 }
|
func Getpagesize() int { return 4096 }
|
||||||
|
|
||||||
// Converts a Go function to a function pointer conforming
|
// NewCallback converts a Go function to a function pointer conforming to the stdcall calling convention.
|
||||||
// to the stdcall or cdecl calling convention. This is useful when
|
// This is useful when interoperating with Windows code requiring callbacks.
|
||||||
// interoperating with Windows code requiring callbacks.
|
func NewCallback(fn interface{}) uintptr {
|
||||||
// Implemented in runtime/syscall_windows.goc
|
return syscall.NewCallback(fn)
|
||||||
func NewCallback(fn interface{}) uintptr
|
}
|
||||||
func NewCallbackCDecl(fn interface{}) uintptr
|
|
||||||
|
// 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.
|
||||||
|
func NewCallbackCDecl(fn interface{}) uintptr {
|
||||||
|
return syscall.NewCallbackCDecl(fn)
|
||||||
|
}
|
||||||
|
|
||||||
// windows api calls
|
// windows api calls
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user