Microsoft KB Archive/184281

= BUG: Constants Used in Function Call Breaks Binary Compatibility =

Article ID: 184281

Article Last Modified on 11/18/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Control Creation Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition

-



This article was previously published under Q184281



SYMPTOMS
When trying to compile an ActiveX DLL or ActiveX EXE, the following error is received, even when you have not modified any interfaces:

 in the  class module has arguments and/or a return type that is incompatible with a similar declaration in the version compatible component.



CAUSE
This error is caused by using a CONSTANT (CONST) in a function declaration.



RESOLUTION
In the function declaration, use the actual value of the CONSTANT, rather than the CONSTANT itself.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
The steps to resolve this problem are as follows:

Steps To Reproduce
 Create a new ActiveX DLL Project in Visual Basic.  Add the following code to the default class module: Public Sub CauseSomeTrouble(Optional Test As String = vbNullString) Msgbox "This Will Not Work For Long!" End Sub  On the File menu, click Make Project1.dll. This action compiles the project into a final DLL/EXE executable. On the Project menu, click Project1 Properties, and click the Component tab. Under Version Compatibility, select Binary Compatibility. Click the ellipsis on the right, and in the Compatible ActiveX Component dialog box, double-click the Project1.dll file that you created in step 3. Click OK.</li> Attempt to make the DLL again (repeat step 3).</li></ol>

RESULTS: The following error dialog box appears:

CauseSomeTrouble in the Class1 class module has arguments and/or a return type that is incompatible with a similar declaration in the version compatible component.

Steps To Resolve
Change the following line of code shown in step 2 above from: Public Sub CauseSomeTrouble(Optional Test As String = vbNullString) -to- Public Sub CauseSomeTrouble(Optional Test As String = "")

Keywords: kbbug kbpending KB184281

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.