Solved

Binary Compatibility

Posted on 2002-07-12
3
204 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 142

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

864 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now