funcmain() { var ret uintptr var err error ret, _, err = getDllVersion.Call() fmt.Printf("%d.%d\n", byte(ret), uint8(ret>>8)) fmt.Println(err) path := "C:\\Program Files (x86)\\AliWorkbench" _, _, err = setQianNiuPath.Call(strPtr(path), lenPtr(path)) fmt.Println(err) }
执行结果
1 2 3 4 5 6
$ GOARCH=386 go run main.go 1.0 The operation completed successfully. SetQianNiuPath, C:\Program Files (x86)\AliWorkbench 35 SetQianNiuPath result 0 The operation completed successfully.