KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q42470: If BC /O, CHAIN "x.BAS" Fails to Give Run-Time Error and Hangs

Article: Q42470
Product(s): See article
Version(s): 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | SR# S890217-22 buglist4.50 | mspl13_basic
Last Modified: 26-FEB-1990

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 ".BAS" extension:

   CHAIN "prog2.BAS"

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 "module name" 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.

Microsoft has confirmed this to be a problem 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 "PROG2" will CHAIN to PROG2.BAS in QB.EXE
  CHAIN "PROG2" 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 "CHAINing to PROGRAM #2"
   CHAIN "prog2.bas"
   END

   '*** PROGRAM #2 (PROG2.EXE)
   '**************
   PRINT "INSIDE PROGRAM #2"
   END

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.