Solved

Binary Compatibility

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

760 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

23 Experts available now in Live!

Get 1:1 Help Now