Let's say I have a function:
int foo (int A, char B){...}
One of the features that I want to implement is the ability for the user to call any function in the application through the Linux terminal. Since the input is for software, in the terminal they print something like:
foo 2 'a'
Then my application parses this, and using character tables, it can find the address for foo() , as well as the type for all its parameters.
However, I'm not sure how to pass the parameters of the function when called, since I can have hundreds of different combinations of parameter types depending on the function being called.
Any hint on how this could be achieved without hundreds of nested if statements casting the parameters to the correct types before calling the functions?
This functionality is similar to what GDB has, where you can make call foo(2,'a') and GDB calls this function for you.
source share