How can I call a C++ function from a string?
Instead of doing this, call the method straight from string:
void callfunction(const char* callthis, int
Alternative: You could use array of function pointers and call the desired function using its index.
typedef void (*TFunc)(int, int);
TFunc arrptr[100];
void callFunction(int index, int params[])
{
(*arrptr[index])(params[0], params[1]);
}
You could wrap your function declarations into an interpreted language (like Lua or Perl or Python (boost has some nice framework for that) ). Then use that language to call your code 'by string'.
These languages/wrappers are built to do such things. C++ isn't, so you will put a lot of effort in adding support for it.