BUG: #UNDEFINE Not Releasing Constant in a ScreenLast reviewed: April 30, 1996Article ID: Q119762 |
The information in this article applies to:
SYMPTOMSA constant is not released from memory even though the #UNDEFINE <constant name> preprocessor directive is written into a screen snippet. The screen code generator program, GENSCRN.PRG, ignores this line. Consequently, the generated file (.SPR) is missing the #UNDEFINE line of code.
CAUSEThe preprocessor directive #UNDEFINE <constant name> releases the constant created by the preprocessor directive #DEFINE <constant name> from memory at run time. The screen generator program, GENSCRN.PRG, is missing a condition for a code snippet line beginning with the #UNDEFINE command, in the procedure WRITECODE.
RESOLUTIONTo correct this problem, modify the generated screen code file (the .SPR file) and add in the #UNDEFINE <constant name> directive where needed, or modify the GENSCRN.PRG file as outlined below. A minor modification to the GENSCRN.PRG program will enable this command. Add the following line of code to the CASE statement "CASE m.upline = #" at around line 2942, in the procedure WRITECODE:
OR LEFT(m.upline,5) = "#UNDE" ;After modification, the code in the CASE statement should be similar to the code below:
CASE m.upline = "#" * don't output a generator directive, but #DEFINES are OK IF LEFT(m.upline,5) = "#DEFI" ; OR LEFT(m.upline,5) = "#UNDE" ; OR LEFT(m.upline,3) = "#IF" ; OR LEFT(m.upline,5) = "#ELSE" ; OR LEFT(m.upline,6) = "#ENDIF" ; OR LEFT(m.upline,8) = "#INCLUDE" \<<m.line>> ENDIF STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Steps to Reproduce ProblemPlace the following code in the setup code snippet of a screen. Generate the screen, then run the generated code program.
#DEFINE x 2 ? x #UNDEFINE x ? xThe number 2 will be output twice to the FoxPro desktop; however, you should receive the error message "Variable 'X' not found" when the second "? x" command is encountered at run time. This error never appears because the line
#UNDEFINE xis not generated into the .SPR file.
|
Additional reference words: FoxMac FoxDos FoxWin 2.50b 2.50c 2.60
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |