Example #1
0
func main() {
	sl := make([]*int, 5)
	var a int = 5
	sl[1] = &a
	C.plusOne((**C.int)((unsafe.Pointer)(&sl[0])))
	fmt.Println(sl[0])
}
Example #2
0
func main() {
	f := &C.struct_Foo{}
	f.a = 5
	f.p = (*C.int)((unsafe.Pointer)(new(int)))

	C.plusOne(&f.a)
	fmt.Println(int(f.a))
}