}
string ctypename = param.parameter_type.get_cname ();
+ string target_ctypename = "void*";
if (param.direction != ParameterDirection.IN) {
ctypename += "*";
+ target_ctypename += "*";
}
param.ccodenode = new CCodeFormalParameter (get_variable_cname (param.name), ctypename);
generate_delegate_declaration (d, decl_space);
if (d.has_target) {
- var cparam = new CCodeFormalParameter (get_delegate_target_cname (get_variable_cname (param.name)), "void*");
+ var cparam = new CCodeFormalParameter (get_delegate_target_cname (get_variable_cname (param.name)), target_ctypename);
cparam_map.set (get_param_pos (param.cdelegate_target_parameter_position), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (param.cdelegate_target_parameter_position), get_variable_cexpression (cparam.name));
}
}
} else if (param.parameter_type is MethodType) {
- var cparam = new CCodeFormalParameter (get_delegate_target_cname (get_variable_cname (param.name)), "void*");
+ var cparam = new CCodeFormalParameter (get_delegate_target_cname (get_variable_cname (param.name)), target_ctypename);
cparam_map.set (get_param_pos (param.cdelegate_target_parameter_position), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (param.cdelegate_target_parameter_position), get_variable_cexpression (cparam.name));
instance_cb (42);
}
+ void assign_instance_delegate (out InstanceCallback instance_cb) {
+ instance_cb = foo_method;
+ }
+
static void test_function_pointers () {
stdout.printf ("testing function pointers:");
var table = new HashTable<string, Bar>.full (str_hash, str_equal, g_free, Object.unref);
InstanceCallback instance_cb = bar.do_instance_action;
call_instance_delegate (instance_cb);
+ bar.assign_instance_delegate (out instance_cb);
+ call_instance_delegate (instance_cb);
+
stdout.printf (" 7\n");
test_function_pointers ();