The information in this article applies to:
SYMPTOMSWith #import, you can generate classes that encapsulate the typelib of database API's, such as Remote Data Objects (RDO) within a windows application. For example:
When you use #import for RDO, you may receive these errors. The first is
for a conflict with the ResultSet.EOF property, and the second is for the
Environment.GetUserName method.
CAUSEIn this case, two separate problems are creating the four compiler errors. "EOF" Property and #importWithin an application that uses STDIO.H, IOS.H or STREAMB.H (including AFXWIN.H ), EOF has already been defined as a constant (-1). #import defines the EOF property for RDO's Resultset object. At compile time, this generates the C2629/C2238 errors on this line of generated code in the MSRDO20.TLH file:
This line is attempting to define a variable, but EOF has already been
defined as -1. So the above line of code parses to:
which will not compile because -1 is not a valid variable name.
GetUserName and #importThe compiler errors C2535 and C2084 are an indication that Msrdo20.dll's typelib is using a name that is mapped by #define to another name that's also used. In this case, the _rdoEnvironment interface has properties UserName and UserNameA. #import creates property get methods for GetUserName and GetUserNameA. However, there's a GetUserName Win32 API that the system headers #define to GetUserNameA (or GetUserNameW for Unicode). That means, after preprocessing, the compiler sees two definitions for _rdoEnvironment::GetUserNameA.RESOLUTIONTo correct both problems, the rename clause will be used as follows:
This time, it willll compile without error. If you look at _rdoEnvironment
in Msrdo20.tlh, you'll now see properties UserName and _UserNameA, with
propget methods GetUserName and Get_UserNameA.NOTE: The rename attribute renames UserNameA, not GetUserNameA. That's because rename must be applied to an actual name from the typelib, and only UserNameA, not GetUserNameA, appears there. Instead, GetUserNameA is a name synthesized by the #import mechanism. Additional query words: MfcDatabase RDOALL RDOVC kbVC600 kbVC500 kbMFC kbdse kbDSupport
Keywords : |
Last Reviewed: August 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |