I don't know if what I am trying to do is possible but it would be grate to be. It will really prove that C++ is a strong language.
So, I have a DLL and an EXE that uses a function exported by the DLL. That function takes an argument which is, or must be a pointer to another function, and executes it. Something like this:
extern void RunFunction(void (*FunctionPonter)()) {
(*FunctionPonter)();
}
and I call it like this:
RunFunction(&FunctionToExecute);
The function sent as an argument will not have arguments, just a void function.
So, all this works, as it is presented here. Now, I would like to go further and define (*void)() as, for example, Action.
typedef (*void)() Action;
Action FunctionToExecute() {
// My code. This function won't return results - void
}
and I would like to send the pointer to the function in my DLL like this:
// This is how it would be declared now in the DLL
extern void RunFunction(void (ACTION) {
(*FunctionPonter)();
}
// and this is how I would like to use it
RunFunction(FunctionToExecute);
I am using VC2010 and I don't know how could I do that, if it is possible. Thanks for your ideas, explanations and help!
void (*)()and anActionare indistinguishable to the compiler.