Microsoft KB Archive/61483

= &quot;Illegal Function Call&quot; CHAINing to Stand Alone, /Fpa, or /Fs =

Article ID: 61483

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q61483



SUMMARY
Attempting to CHAIN from an EXE that requires a run-time module to a stand-alone EXE causes the run-time error &quot;Illegal Function Call&quot; on the CHAIN statement.

This error message does not occur when CHAINing in the reverse direction (from a stand-alone EXE to an EXE that requires a run-time module), or when CHAINing between identical EXE types (both stand alone, or both run time), or when using the RUN statement instead of CHAIN.

&quot;Illegal Function Call&quot; also occurs when CHAINing from an EXE that requires a run-time module to an EXE compiled with a different math package (/Fpa versus /Fpi; found only in BC.EXE 6.00, 6.00b, 7.00, or 7.10) or compiled with a different string option (/Fs far strings versus near strings; found only in Microsoft Basic Professional Development System (PDS) version 7.00 or 7.10).

This information applies to Microsoft QuickBasic versions 4.00, 4.00b, and 4.50 for MS-DOS; to Microsoft Basic Compiler versions 6.00 and 6.00b for MS-DOS and MS OS/2; and to Microsoft Basic PDS versions 7.00 and 7.10 for MS-DOS and MS OS/2.

This information also applies to Visual Basic for MS-DOS version 1.00.



MORE INFORMATION
When transferring control to an EXE with a different run-time module, the RUN statement is the preferred method. RUN makes no attempt to preserve any values on the transfer, whereas CHAIN tries to maintain COMMON variables. The CHAIN statement should be used only when transferring control to another Basic program that uses the same Basic run-time library as the one being CHAINed from.

Code Example
The following code example produces an &quot;Illegal Function Call&quot; on the CHAIN statement when the two programs are compiled as indicated: 'A.BAS 'Compile and link lines: '  BC A;   '   LINK A;   CHAIN &quot;B&quot;         'RUN does not cause the error END

'B.BAS 'Compile and link lines: '  BC /o B;   '   LINK B;   PRINT &quot;In Program B&quot;

Additional query words: QuickBas BasicCom

Keywords: KB61483

-

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

© Microsoft Corporation. All rights reserved.