Displaying 1 result from an estimated 1 matches for "c_optarg".
Did you mean:
_optarg
2020 Apr 29
0
golang: panic: runtime error: cgo argument has Go pointer to Go pointer
...uot;proto is %s\n", optargs->protocol);
int num = strlen(*optargs->addr)-1;
int i = 0;
for(i=0;i<num;i++){
printf("%s\n",optargs->addr[i]);
}
}
*/
import "C"
import (
"unsafe"
)
func main(){
c_optargs := C.struct_t_server{}
c_optargs.protocol = C.CString("test")
serverlist := []string{"aaa", "bbb", "ccc"}
var buf []*C.char
for i, _ := range serverlist {
buf = append(buf, (*C.char)(unsafe.Pointer(C.CString(server...