Exemple #1
0
func Init(args []string) {
	argc := C.int(len(args))
	iLen := len(args)
	if iLen != 0 {
		argv := make([]*C.char, iLen)
		for i := 0; i < iLen; i++ {
			argv[i] = C.CString(args[i])
		}
		C._gtk_init(unsafe.Pointer(&argc), unsafe.Pointer(&argv))
		for i := 0; i < iLen; i++ {
			args[i] = C.GoString(argv[i])
			C.free(unsafe.Pointer(argv[i]))
		}
	} else {
		C._gtk_init(nil, nil)
	}
}
Exemple #2
0
func init() {
	alen := C.int(len(os.Args))
	argv := make([]*C.char, alen)
	for i, s := range os.Args {
		argv[i] = C.CString(s)
	}
	ret := C._gtk_init(&alen, &argv[0])
	argv = (*[1 << 16]*C.char)(unsafe.Pointer(ret))[:alen]
	os.Args = make([]string, alen)
	for i, s := range argv {
		os.Args[i] = C.GoString(s)
	}
}
Exemple #3
0
func Init() {
	C._gtk_init(nil, nil)
}