Article ID: 195049 - Last Review: March 14, 2005 - Revision: 2.2 How To Maintain Binary Compatibility in Components Exposing ADOThis article was previously published under Q195049 SUMMARY
Recompiling a Visual Basic Project that uses Binary Compatibility can
generate a warning to the following effect:
"...module has arguments and/or return type that is incompatible with a
similar declaration in the version compatible component.
...
Original Definition: Function <function_name> as ADODB.Recordset15
Current Definition: Function <function_name> as ADODB.Recordset
..."
Compile Error: Procedure declaration does not match description of event
or procedure having the same name.
MORE INFORMATION
Visual Basic code makes use of Version Independent ProgIDs such as
"ADODB.Recordset". This Version Independent ProgID is then used to obtain a
Class ID for that particular class when you compile the project. Under ADO
1.5, for example, the Version Independent ProgIDs mapped to the ADO 1.5 Interface ClsIDs.
When you attempt to recompile a component with a later version of ADO, the Version Independent
ProgIDs now map to the later Interface ClsIDs. For example, ADO and later Interfaces are
not Binary Compatible with the ADO 1.5 interfaces.
To make the component Binary Compatible with Clients expecting an earlier interface, make the ADO interface(s) exposed version-specific. For example, change the function declaration from a version independent declaration: To specify a version specific declaration, append the version identifier to the ADO object: After modifying the declarations, the project compiles without the Binary Compatibility warning. Following is a more complete example of taking the ADO code to a later version of ADO while maintaining binary compatibility with the earlier version. The following example is an ADO method that returns an ADO RecordSet object. If this function was compiled under ADO 1.5, you would have to modify the function declaration so that it would maintain binary compatibility with ADO 1.5. The benefit of this implementation in Visual Basic is that the code can take advantage of the new features and benefits of a new version of ADO and still remain binary compatible with clients expecting the earlier interfaces. REFERENCESFor additional information on maintaining binary compatibility with an earlier version of ADO, click the article number below
to view the article in the Microsoft Knowledge Base:
222145
(http://support.microsoft.com/kb/222145/EN-US/
)
PRB: ADO Data Control Events May Generate a Compilation Error
For more information on binary compatibility, ProgID's and ClsID's, and COM
please refer to the following books:
Inside COM (Programming Series), Dale Rogerson, Microsoft Press, February 1997. Inside Distributed COM, Guy Eddon, Henry Eddon, Microsoft Press, April 1998. Understanding ActiveX and OLE, David Chappell, Microsoft Press, September 1996. APPLIES TO
| Article Translations
|
Back to the top
