Import issues using ADO in Regular DLL in VC

xiaoxiao2021-03-06  81

This period of time is used to use ADO in the DLL. It does not have any problems with ADO in the MFC. This thought that there will be no problems in the DLL, but the problem is generated, and it is in the first imported ADO DLL. Announcement. My approach is:

#import "c: / program files / common files / system / ado / msado15.dll" no_namespace rename "): compiling resources ... compling ... stdafx.cppf: / source / vc /Query/debug/msado15.tlh (169): Error C2011: 'LockTyPeenum': 'enum' type redefinitionf: /source/vc/query/debug/msado15.tlh (212): Error C2011: 'DattyPeenum': 'enum 'type redinitionf: /source/vc/query/debug/msado15.tlh (256): Error C2011:' FieldattributeEnum ':' enum 'type redefinitionf: /source/vc/query/debug/msado15.tlh (277): Error C2011: 'EditModeEnum': 'enum' type redefinitionF: /source/vc/Query/debug/msado15.tlh (285): error C2011: 'RecordStatusEnum': 'enum' type redefinitionF: / source / vc / Query / debug / msado15.tlh (405): warning C4146: unary minus operator applied to unsigned type, result still unsignedF: /source/vc/Query/debug/msado15.tlh (527): error C2011: 'ParameterDirectionEnum': 'enum' type redefinitionError Executing cl.exe.

Adidlltest.dll - 6 Error (s), 1 Warning (s)

Later, after search on 9CBS, I found two ways to solve this problem.

1)

#pragma Warning (Disable: 4146) #import "c: / program files / common files / system / ado / msado15.dll" named_guids rename ("EOF", "AdoEOf"), Rename ("Bof", "AdoBof") #pragma Warning (Default: 4146) Using Namespace AdoDB;

2)

#pragma Warning (Disable: 4146) #import "C: / Program files / compon files / system / ado / msado15.dll" / no_namespace / rename ("EOF", "AdoEOF") Rename ("DattyPeenum", "AdodattyPeenum" ) / rename ( "FieldAttributeEnum", "adoFielAttributeEnum") rename ( "EditModeEnum", "adoEditModeEnum") / rename ( "LockTypeEnum", "adoLockTypeEnum") rename ( "RecordStatusEnum", "adoRecordStatusEnum") / rename ( "ParameterDirectionEnum", "AdoparameterDirectionenum") is relatively simple, and the first way is even easier.

I hope that friends who have encountered similar problems will give you some help.

转载请注明原文地址:https://www.9cbs.com/read-121999.html

New Post(0)