Microsoft KB Archive/34291

= Using Same Source to CHAIN When Both Interpreted and Compiled =

Article ID: 34291

Article Last Modified on 1/8/2003

-

APPLIES TO


 * Microsoft QuickBasic Compiler for Macintosh 1.0

-



This article was previously published under Q34291



SUMMARY
The following information applies to the Microsoft QuickBASIC Compiler Version 1.00 for the Apple Macintosh.

It is possible to write a QuickBASIC program that CHAINs both in the interpreter environment and in a compiled application without changes to the source file. The first method uses the $IGNORE metacommand, while the second uses the SYSTEM(4) function. The REM $IGNORE ON metacommand instructs the compiler to ignore the following statements until a REM $IGNORE OFF is encountered. The SYSTEM(4) function returns 1 in a compiled program and 0 in an interpreted program.



MORE INFORMATION
Let us assume that we have a program &quot;proga&quot; which CHAINs to &quot;progb&quot;. The following is the listing for &quot;progb&quot;: PRINT &quot;inside progb&quot; END When you compile the &quot;progb&quot; source file, the compiler names the compiled application &quot;progb apl&quot; by default.

The following is the listing for &quot;proga&quot; using the first (REM $IGNORE ON/OFF) method: CLS PRINT &quot;inside proga&quot; ext$ = &quot; Apl&quot; nxtprog$ = &quot;progb&quot; REM $IGNORE ON ext$ = &quot;&quot; REM $IGNORE OFF nxtprog$ = nxtprog$ + ext$ CHAIN nxtprog$ The following is the listing for &quot;proga&quot; using the second [i.e., SYSTEM(4)] method: CLS PRINT &quot;inside proga&quot; ext$ = &quot; Apl&quot;  ' Compiler appends &quot; Apl&quot; to application names. nxtprog$ = &quot;progb&quot; ' When SYSTEM(4) returns 0, we're inside environment: IF SYSTEM(4) = 0 THEN ext$ = &quot;&quot; nxtprog$ = nxtprog$ + ext$ CHAIN nxtprog$

Additional query words: MQuickB

Keywords: KB34291

-

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

© Microsoft Corporation. All rights reserved.