Where is SetOaNoCache defined?

喜欢而已 提交于 2019-12-22 08:13:03

问题


Attempting to disable BSTR caching:

SetOaNoCache();

VC++ compiler build output:

  • 'SetOaNoCache': identifier not found

Don't want to use:

  • OANOCACHE=1

Question:

  • Where is SetOaNoCache defined - header file?

回答1:


It is not defined in a header file, it is in OLEAUT32.dll. You can call it like this:

typedef int (*SETOANOCACHE)(void);

void DisableBSTRCache() { HINSTANCE hLib = LoadLibrary("OLEAUT32.DLL"); if (hLib != NULL) { SETOANOCACHE SetOaNoCache = (SETOANOCACHE)GetProcAddress(hLib, "SetOaNoCache"); if (SetOaNoCache != NULL) SetOaNoCache(); FreeLibrary(hLib); } }




回答2:


It's not. From the Win32 API library shipped with C++ Builder:

Requirements

Windows XP: Requires Windows XP Service Pack 2 or later.

Windows 95/98: Not supported.

Header: Not supplied. Declare prototype as shown.

Library: Use oleaut32.lib.

The prototype as shown:

inline void TurnOffCache ()
{
// Function prototype.
extern "C" SetOaNoCache(); 
// Turn off BSTR caching.
SetOaNoCache();
}


来源:https://stackoverflow.com/questions/553846/where-is-setoanocache-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!