4

尝试禁用BSTR 缓存:

SetOaNoCache();

VC++ 编译器构建输出

  • 'SetOaNoCache': identifier not found

不想使用:

  • OANOCACHE=1

问题:

4

2 回答 2

7

它没有在头文件中定义,它在 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); } }

于 2009-02-16T16:26:22.247 回答
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();
}
于 2009-02-16T16:28:31.757 回答