LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how function with argumets called without argumets? (https://www.linuxquestions.org/questions/programming-9/how-function-with-argumets-called-without-argumets-301815/)

cranium2004 03-15-2005 07:06 AM

how function with argumets called without argumets?
 
Hello,

In kernel source i found a statement

#ifdef CONFIG_PROC_FS
tb->tb_get_info = fn_hash_get_info;
#endif
which is called from struct fib_table * fib_hash_init(int id)

and all these are in fib_hash.c in /usr/src/linux-2.4.24/net/ipv4

What i want to know is simple thing about how fn_hash_get_info gets called? that mean i found its calling without any arguments whereas i found same function written in same file with
static int fn_hash_get_info(struct fib_table *tb, char *buffer, int first, int count)

How then function gets its parameters???

regards,
cranium

zeropash 03-15-2005 08:32 AM

tb->tb_get_info = fn_hash_get_info;
is not calling the function fn_hash_get_info.
it is just saving the address in the tb_get_info.
remeber that the function name is same as the address where its code lies.

somewhere later he would make the actual call using
(*tb->tb_get_info)(PARAMETERLISTHERE)


All times are GMT -5. The time now is 04:44 AM.