Oh, so question is about typedef.
This typedef defines new type which is function type.
"typedef int X;" defines new type X which is int.
"typedef void A(int, float)" defines function type A which accepts two arguments - int and float.
You can use such type A to create function pointers and call function indirectly.
| void RealFunction1(int x, float y) { ... }
void RealFunction2(int x, float y) { ... }
...
A* FunctionPointer = RealFunction1;
FunctionPointer(1, 2.0f); // call RealFunction1
FunctionPointer = RealFunction2;
FunctionPointer(1111, 2222.0f); // call RealFunction2
|
Function pointer is similar to regular pointer. But instead of pointing to data, it points to code - to a function. And you can change dynamically at runtime to which function it points. So you can make decision at runtime which function to call.
That is exactly what is happening in HandmadeHero. At runtime DLL is loaded and address of function is retrieved by GetProcAddress. Then it is assigned to function pointer which get called when needed. And once dll is reloaded, different address is assigned to function pointer.