Chameleon > DevTalk

Modules and register_hook_callback


Hi all,

can someone please explain values for register_hook_callback calls in module development?


hi, here is a very simple example

--- Code: ---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;
--- End code ---

execute entry_point() will give this result:

--- Quote ---Hello, World!
the value is 2
--- End quote ---

i hope this will help  :)


[0] Message Index

Go to full version