It isn't if you wisely use typedefs. You would just have to consider it as a new type without thinking too much about the fact it's a pointer to function.
Remember, though, the syntax may be weird, but the concept is the same as regular pointers. Functions are stored in memory addresses just like variables and a pointer to a function holds the address of the function it points to. Dereferencing it and passing it appropriate parameters will do the same as using the function directly.
Code:
typedef bool (*WMHandlerPtr) (HWND, WPARAM, LPARAM);
bool Plugin::GetWMHandlerPtr(const char* func_name) {
myHandler = (WMHandlerPtr) GetProcAddress(myModule, func_name);
return (myHandler == 0);
}
void Plugin::OnLButtonDown(HWND hwnd, WPARAM wprm, LPARAM lprm) {
try {
if(myHandler == 0)
throw("OnLButtonDown");
(*myHandler)(hwnd, wprm, lprm);
} catch(const char* func) {
if(!GetWMHandlerPtr(func))
throw();
}
}
I coded this on the fly and I thought maybe I'd add a little error checking but I'm not too sure about the code. It should be something like this, though.