1

In Windows, this is the most common way to call a Win32 function (resumed steps to call GetForegroundWindow function):

dllUser32 := syscall.NewLazyDLL("user32.dll")
GetForegroundWindow := dllUser32.NewProc("GetForegroundWindow")
hwnd, _, _ := syscall.Syscall(proc.GetForegroundWindow.Addr(), 0,
    0, 0, 0)

I understand why cgo is slow, and that cgo isn't used with Win32 calls, but with other C code. But now my question is: how can I compare the code above to a cgo call, in terms of overhead?

Does it use cgo under the hood?

Does it have the same overhead of a cgo call?

rodrigocfd
  • 6,450
  • 6
  • 34
  • 68

0 Answers0