SetOaNoCache在哪里定义?

时间:2009-02-16 16:17:58

标签: c++ visual-studio-2008 disable-caching

尝试禁用 BSTR缓存:

SetOaNoCache();

VC ++编译器构建输出

  • 'SetOaNoCache': identifier not found

想要使用:

  • OANOCACHE = 1

问题:

2 个答案:

答案 0 :(得分:6)

它没有在头文件中定义,它在OLEAUT32.dll中。你可以这样称呼它:

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); } }

答案 1 :(得分:3)

不是。来自C ++ Builder附带的Win32 API库:

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.

原型如图所示:

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