Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Calling Windows API from Go
package win32
import "syscall"
import "unsafe"
var (
kernel32DLL = syscall.NewLazyDLL("kernel32.dll")
procCreateJobObjectA = kernel32DLL.NewProc("CreateJobObjectA")
// CreateJobObject uses the CreateJobObjectA Windows API Call to create and return a Handle to a new JobObject
func CreateJobObject(attr *syscall.SecurityAttributes, name string) (syscall.Handle, error) {
r1, _, err := procCreateJobObjectA.Call(
if err != syscall.Errno(0) {
return 0, err
return syscall.Handle(r1), nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.