예제 #1
0
파일: callc.go 프로젝트: kunos/tutorials
func main() {

	// Simply call add10
	fmt.Println("Simple call:", C.add10(10))

	// Store into a var and print
	a := C.add10(10)

	fmt.Println("var from C:", a)

	// Pass a value to C
	govar := 10
	cresult := C.add10(C.int(govar))

	fmt.Println("go var passed to C:", cresult)

	// Full conversion
	goresult := int(C.add10(C.int(govar)))
	govar2 := 30
	// Now goresult is a full Go "int" and I can use without casts
	goadd := goresult + govar2

	fmt.Println("Full conversion:", goadd)

	// Call Windows API
	fmt.Println("GetTickCount()=", C.GetTickCount())

	// Call API that needs an additional library
	fmt.Println("timeGetTime=", C.timeGetTime())

}
예제 #2
0
파일: timer_windows.go 프로젝트: kunos/ks
func GetTimeMillis() uint64 {
	return uint64(C.timeGetTime())
}