Solved

Binary Compatibility

Posted on 2002-07-12
3
206 Views
Last Modified: 2010-05-02
I have an ActiveX dll I created that is in use by several clients.  I need to add some additional functionality that requires me to pass an additional piece of info to the component.

This may be a dumb question, but I will ask anyways.  Should I add the new parameter as a public property, or should I just add it as a parameter you have to pass to a method.  In otherwords, "Public Function MyMethod(ByVal MyNewParameter as String) As String".

Will either of these maintain binary compatibility?

Thanks,
DG
0
Comment
Question by:d_glenn
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 7149480
If you ADD a property, binary compatibility will be maintained.
If you ADD a parameter, binary compatibility will break.
If you ADD a new function (MyFunctionEx), with the same parameters + the new one, compatibility will be maintained.

Depending on the usage, I take different choice. Most of the cases, I use both, adding the property to call the old function afterwards, or if the old function is called, it will in fact run the new function with some default value for this new parameter.

CHeers
0
 
LVL 5

Expert Comment

by:rpai
ID: 7149482
When you add new Public Property what you will be doing is basically enhancing your component. As long as you make no changes to existing properties and methods, Visual Basic updates the version number of the type library but keeps it compatible with the old version number. Client applications that are built using the new version of your component will compile with the new version number, and can make use of all the new features. They cannot be used with earlier versions of your component, however, because type library versions are only upward-compatible.

Adding a parameter to the Method will cause VB to make the version number of the type library incompatible, rendering the new version unusable with client applications compiled with earlier versions.

0
 
LVL 1

Author Comment

by:d_glenn
ID: 7149504
Thanks for both your help.  Exactly what I am looking for.  Since you both answered the question at the same time, you both deserve the points.

rpai, you can find your points here:

http://www.experts-exchange.com/visualbasic/Q_20322665
.html
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Determine Range to Select 5 55
Adding to a VBA? 6 84
VB6 - Scroll Mouse wheel on Picturebox 13 94
Copy a range from 1..n excel sheets to one destination sheet 2 66
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question