I have a basic question on function pointer.
In the below code snippet, how do I read this "
*(FARPROC*)&pfn ="?
IFastString *CallCreateFastString(const char *psz) {
static IFastString * (*pfn)(const char *) = 0;
if (!pfn) {
const TCHAR szDll[] = _TEXT("FastString.DLL");
const char szFn[] = "CreateFastString";
HINSTANCE h = LoadLibrary(szDll);
if (h)
*(FARPROC*)&pfn = GetProcAddress(h, szFn);
}
return pfn ? pfn(psz) : 0;
}
GetProcAddress- you'll see that the case above is convoluted...msdn.microsoft.com/en-us/library/ms683212(v=vs.85).aspx