Exemple #1
0
//export _go_glib_callback
func _go_glib_callback(cbi *C.callback_info) {
	context := callback_contexts[int(cbi.func_no)]
	t := context.f.Type()
	fargs := make([]reflect.Value, t.NumIn())
	if len(fargs) > 0 {
		fargs[0] = reflect.ValueOf(context)
	}
	ret := context.f.Call(fargs)
	if len(ret) > 0 {
		bret, _ := ret[0].Interface().(bool)
		cbi.ret = gbool(bret)
	}
}
Exemple #2
0
//export _go_glib_callback
func _go_glib_callback(cbi *C.callback_info) {
	value, found := callback_contexts.Get(int(cbi.func_no))
	if !found {
		return
	}
	context := value.(*CallbackContext)
	t := context.f.Type()
	fargs := make([]reflect.Value, t.NumIn())
	if len(fargs) > 0 {
		fargs[0] = reflect.ValueOf(context)
	}
	ret := context.f.Call(fargs)
	if len(ret) > 0 {
		bret, _ := ret[0].Interface().(bool)
		cbi.ret = gbool(bret)
	}
}