, . , DLL FastString CreateFastString. DLL, LoadLibrary, GetProcAddress:
IFastString *CallCreateFastString(const char *psz) { static IFastString * (*pfn)(const char *) = 0; if (!pfn) { // init ptr 1st time through // ptr 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; }
. , , . , , WinSock MAPI, . DLL, DLL , DLL . . , DLL ; , DLL . , DLL.
, . IFastString (publicly available), (implementor) FastString, . FastString, , . , , ("plug-compatible") , DLL.
, , , IFastString . , ( , , , ). , , IFastString, . DLL ( , FastStringRL.DLL). DLL , IFastString DLL :
IFastString * CallCreateFastString(const char *psz, bool bLeftToRight = true) { static IFastString * (*pfnlr)(const char *) = 0; static IFastString * (*pfnrl)(const char *) = 0; IFastString *(**ppfn) (const char *) = &pfnlr; const TCHAR *pszDll = _TEXT("FastString.DLL"); if (!bLeftToRight) { pszDll = _TEXT("FastStringRL.DLL"); ppfn = &pfnrl; } if (!(*ppfn)) { // init ptr 1st time through // ptr const char szFn[] = "CreateFastString"; HINSTANCE h = LoadLibrary(pszDll); if (h) *(FARPROC*)ppfn = GetProcAddress(h, szFn); } return (*ppfn) ? (*ppfn)(psz) : 0; }
,
pfs = CallCreateFastString("Hi Bob!"); n = pfs->Find("ob");
DLL FastString, . , , :
pfs = CallCreateFastString("Hi Bob!", false); n = pfs->Find("ob");
DLL (FastStringRL.DLL), . , CallCreateFastString , DLL . , IFastString vptr vptr . , .