Voodooprojects
Chameleon => DevTalk => Topic started by: iostres on September 23, 2011, 09:17:40 AM
-
Hi all,
can someone please explain values for register_hook_callback calls in module development?
BR,
iostres
-
hi, here is a very simple example
void print_nb_value_hook(void* arg1, void* arg2, void* arg3, void* arg4)
{
int *value_ptr = (int*)arg1;
int value = *value_ptr;
printf("the value is %i\n", value);
}
void print_Hello_hook(void* arg1, void* arg2, void* arg3, void* arg4)
{
printf("Hello, World!\n");
}
int entry_point ()
{
register_hook_callback("print_nb_value", &print_nb_value_hook);
register_hook_callback("print_Hello", &print_Hello_hook);
execute_hook("print_Hello", NULL, NULL, NULL, NULL);
int i_want_2_print_this_value_through_my_callback = 2;
execute_hook("print_nb_value", &i_want_2_print_this_value_through_my_callback, NULL, NULL, NULL);
return 0;
}
execute entry_point() will give this result:
Hello, World!
the value is 2
i hope this will help :)