Search code examples
c++visual-studio-2008disable-caching

Where is SetOaNoCache defined?


Attempting to disable BSTR caching:

SetOaNoCache();

VC++ compiler build output:

  • 'SetOaNoCache': identifier not found

Don't want to use:

  • OANOCACHE=1

Question:


Solution

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