Microsoft KB Archive/45892

= CALL BYVAL &quot;Parameter Type Mismatch&quot; After DECLARE AS ANY =

Article ID: 45892

Article Last Modified on 11/21/2006



This article was previously published under Q45892



SYMPTOMS
Using the CALL subprogramname (BYVAL variable) method of calling an external (non-Basic) routine, where the parameter is specified AS ANY in the DECLARE statement, correctly causes a &quot;Parameter Type Mismatch&quot; at compile time.

To avoid this error, you must add BYVAL and specify the exact type (instead of using AS ANY) in the DECLARE statement, and you must not use BYVAL in the CALL statement. This information applies to Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50, to Microsoft Basic Compiler Versions 6.00 and 6.00b, and to Microsoft Basic Professional Development System (PDS) Version 7.00.

The &quot;Parameter Type Mismatch&quot; error fails to be flagged in the QuickBasic Version 4.50 environment when the external routine is in a Quick Library. QuickBasic Versions 4.00 and 4.00b correctly flag the error.



STATUS
Microsoft has confirmed this to be a bug in QuickBasic Version 4.50. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
The following is taken from the DECLARE statement documentation in the Basic language reference manuals for QuickBasic Versions 4.00, 4.00b, and 4.50 and Basic compiler Versions 6.00 and 6.00b:

You cannot use ANY [in the DECLARE statement] with arguments passed by value.

Code Example
The following code sample should correctly cause a &quot;Parameter Type Mismatch&quot; error on the CALL statement at compile time (where test is an external SUB): DECLARE SUB test (variable AS ANY) i%=10 CALL test(BYVAL i%) The following is the correct method to pass by value to the external procedure: DECLARE SUB test (BYVAL variable AS INTEGER) i%=10 CALL test(i%)

Additional query words: QuickBas BasicCom buglist4.50

Keywords: KB45892

-

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

© Microsoft Corporation. All rights reserved.