Typecasting a void* to a function pointer
Is there any way to do this?
In a program I'm writing there is a class called "command", which is intended to be an element in a list of function calls; it is supposed to contain a pointer to a general function along with the arguments to be used. I want to use a void* for the function pointer variable, for generality and in order to use function arguments that haven't been defined when the command class compiles.
However, when it's time to call the function, I can't seem to convert the void pointer to a function pointer. I've tried various ways of doing this; none of them work - I get a compiler error saying it can't do the conversion (both when I convert to the void* in the first place and in going back to the function pointer).
I suspect from the errors I'm getting that typecasting function pointers is simply not allowed. If it's permissible and I'm just doing something wrong, though, or if you know another way to accomplish the same goal, any advice would be appreciated. I can post example code if necessary.