D
DOA
Help! I've been doing C language development for a long time, but this
problem has me stumped.
I would like the user to be able to enter the name of a function that
has been linked into the application they are currently running, and
have the application call the function they have requested.
Example code:
char fn_name[80];
int (*p_fn)(int,int,int *);
int res1,res2;
printf("Function name? ");
scanf("%s",fn_name);
p_fn = translate_function_name_to_function_address(fn_name);
if (p_fn)
res2 = (*p_fn)(5,20,&res1);
else
printf("ERROR - requested function not found\n");
Question: is a function to do the name-to-address translation
available in most (or any) C libraries and associated development
environments? If not, how would you do it?
Thanks in advance for any hints!
Steve
P.S. Ideally, I wouldn't have to do any custom programming to support
this functionality (e.g. build and search a function name to function
address translation table myself).
problem has me stumped.
I would like the user to be able to enter the name of a function that
has been linked into the application they are currently running, and
have the application call the function they have requested.
Example code:
char fn_name[80];
int (*p_fn)(int,int,int *);
int res1,res2;
printf("Function name? ");
scanf("%s",fn_name);
p_fn = translate_function_name_to_function_address(fn_name);
if (p_fn)
res2 = (*p_fn)(5,20,&res1);
else
printf("ERROR - requested function not found\n");
Question: is a function to do the name-to-address translation
available in most (or any) C libraries and associated development
environments? If not, how would you do it?
Thanks in advance for any hints!
Steve
P.S. Ideally, I wouldn't have to do any custom programming to support
this functionality (e.g. build and search a function name to function
address translation table myself).