1
2
3
4
5
6
7 package cgotest
8
9
10
11
12
13
14
15
16
17
18 import "C"
19 import "unsafe"
20
21
22 var (
23 checkedPointer = []byte{1}
24 doublePointerChecked = []byte{1}
25 singleInnerPointerChecked = []byte{1}
26 )
27
28
29
30
31 func TestSingleArgumentCast() C.int {
32 retcode := C.func_with_char((*C.char)(unsafe.Pointer(&checkedPointer[0])), unsafe.Pointer(C.strarg))
33 return retcode
34 }
35
36 func TestSingleArgumentCastRecFuncAsSimpleArg() C.int {
37 retcode := C.func_with_char((*C.char)(unsafe.Pointer(C.get_arr((*C.char)(unsafe.Pointer(&singleInnerPointerChecked[0])), unsafe.Pointer(C.strarg)))), nil)
38 return retcode
39 }
40
41 func TestSingleArgumentCastRecFunc() C.int {
42 retcode := C.func_with_char((*C.char)(unsafe.Pointer(C.get_arr((*C.char)(unsafe.Pointer(&doublePointerChecked[0])), unsafe.Pointer(C.strarg)))), unsafe.Pointer(C.strarg))
43 return retcode
44 }
45
View as plain text