Commit 062cd7e4 authored by Jeet Parekh's avatar Jeet Parekh Committed by Alex Brainman

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: 's avatarAlex Brainman <alex.brainman@gmail.com>
parent 033028a6
......@@ -71,12 +71,17 @@ func UTF16PtrFromString(s string) (*uint16, error) {
func Getpagesize() int { return 4096 }
// Converts a Go function to a function pointer conforming
// to the stdcall or cdecl calling convention. This is useful when
// interoperating with Windows code requiring callbacks.
// Implemented in runtime/syscall_windows.goc
func NewCallback(fn interface{}) uintptr
func NewCallbackCDecl(fn interface{}) uintptr
// 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.
func NewCallback(fn interface{}) uintptr {
return syscall.NewCallback(fn)
}
// 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment