In c++, let us consider that we have a string or char* functionName and that we know the signature (output and input arguments types) of the function we want to call.
Is there a way to call this function ? I think I have to use function pointer.. But still the problem is to find the pointer of the function by using its name.
In short: No. C++ does not have anything corresponding to Java reflection. You need to know the address where the function is stored to call it, not it's name.
More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity. --W.A.Wulf
Premature optimization is the root of all evil --Donald E. Knuth
That´s not possible in C/C++. Using a std::map storing string/fn pointers pairs might be a solution, but you have to fill the map on your own. You also need a separate map for each function type (signature).
Bookmarks