Microsoft KB Archive/42470

= If BC /O, CHAIN &quot;x.BAS&quot; Fails to Give Run-Time Error and Hangs =

Article ID: 42470

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 4.5 for MS-DOS

-



This article was previously published under Q42470



SYMPTOMS
If two programs are compiled with the BC /O (stand-alone option), and the first program CHAINs to the second program with the following CHAIN statement, then the program fails to give an error message for the &quot;.BAS&quot; extension:   CHAIN &quot;prog2.BAS&quot; The CHAIN is not executed, and program execution either ends or hangs the machine.

The correct response should be the following run-time error:

Illegal Function Call in Module &quot;module name&quot; at address XXXX:XXXX

This information applies only to programs compiled with the stand-alone (/O) switch in QuickBasic Version 4.50. The debug (/D) switch does not change the problem. If compiled requiring BRUN45, the problem does not occur. The problem also doesn't occur with QuickBasic Version 4.00 or 4.00b or Microsoft Basic Compiler Version 6.00 or 6.00b.



STATUS
Microsoft has confirmed this to be a bug in QuickBasic Version 4.50. This problem was corrected in Microsoft Basic Professional Development System (PDS) Version 7.00, (fixlist7.00).

In Microsoft Basic PDS 7.00, the run-time error message generated is as follows:

Bad file mode in module MODULE NAME at address XXXX:XXXX

To work around the problem, do not include an extension on the program name in the CHAIN statement. QB.EXE and BC.EXE are able to determine which program to CHAIN to if there are two files with the same name but different extensions:

CHAIN &quot;PROG2&quot; will CHAIN to PROG2.BAS in QB.EXE

CHAIN &quot;PROG2&quot; will CHAIN to PROG2.EXE in BC.EXE



Code Example
Compiling the following two programs with BC /O demonstrates the problem: '*** PROGRAM #1 (PROG1.EXE) '************  PRINT &quot;CHAINing to PROGRAM #2&quot; CHAIN &quot;prog2.bas&quot; END

'*** PROGRAM #2 (PROG2.EXE) '**************  PRINT &quot;INSIDE PROGRAM #2&quot; END

Additional query words: QuickBas SR# S890217-22 buglist4.50

Keywords: KB42470

-

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

© Microsoft Corporation. All rights reserved.