Beispiel #1
0
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())

}
Beispiel #2
0
func GetTimeMillis() uint64 {
	return uint64(C.timeGetTime())
}