Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Binary Compatibility

Posted on 2002-07-12
3
Medium Priority
?
211 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 200 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…
Suggested Courses

972 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