As weird as it sounds, I need to call a function in C++, for which I do not know the signature. Basically, I want to let the user specify a list of arguments, and argument types, and then attempt to call a given function with these arguments. I would then like to know if the function call worked or not, and if it (miraculously) did, what is the return value (provided that the return type is not void). Is there any way to achieve that? Thanks.
The parameters are the variables in a function, whereas the arguments are the values passed to the parameters when calling the function. The parameters can be mandatory or optional.
There is no pass-by-reference in C.
In computing, compile-time function execution (or compile time function evaluation, or general constant expressions) is the ability of a compiler, that would normally compile a function to machine code and execute it at run time, to execute the function at compile time.
Let your functions take a list of variant data types, e.g. std::vector<boost::any>
and have them return a bool
indicating success or throw exceptions on failure.
If you are ok with registering the exposed functions at compile time, you don't even have to place that restriction on your functions and you can instead generate glue code for the neccessary conversions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With