PRB: #import "shdocvw.dll" / tagREADYSTATE compile errors

Last reviewed: October 3, 1997
Article ID: Q169433
The information in this article applies to:
  • Microsoft Internet Explorer (Programming), version 4.0
  • Microsoft Visual C++, 32-bit Editions, version 5.0

SYMPTOMS

When using the #import compiler directive to import Shdocvw.dll, several errors similar to the following will be reported:

   error C2556: 'GetReadyState' : overloaded functions
   only differ by return type

   error C2371: 'GetReadyState' : redefinition;
   different basic types

   error C2664: 'get_ReadyState' : cannot convert
   parameter 1 from 'enum SHDocVw::tagREADYSTATE *' to 'enum tagREADYSTATE
   *'

When using the #import compiler directive with the no_namespace attribute to import Shdocvw.dll, several errors similar to the following will be reported:

   error C2011: 'tagREADYSTATE' :
   'enum' type redefinition

   error C2871: 'SHDocVw' : does not
   exist or is not a namespace

CAUSE

These errors are generated because of the inclusion of the tagReadyState definition in Ocidl.idl (included by the .idl for shdocvw).

Including tagReadyState in Ocidl.idl causes tagReadyState to be included in the type library for Shdocvw.dll. In turn, #import "shdocvw.dll" includes the definition of tagReadyState in the generated headers for Shdocvw.dll. This definition collides with the definition of tagReadyState in Ocidl.h.

RESOLUTION

The exclude attribute of the #import directive can be used to work around this problem.

Use #import shdocvw.dll as follows:

   #import <shdocvw.dll> exclude("tagREADYSTATE")

The tagReadyState will be defined for your project through the inclusion of Ocidl.h.

STATUS

This behavior is by design.

REFERENCES

Visual C++ Preprocessor Reference: The #import directive

Keywords          : AXSDKIESripting kberrmsg
Technology        : kbInetDev kbole
Version           : 4.0 5.0
Platform          : NT WINDOWS
Issue type        : kbprb


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 3, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.