Use the DEBUG preprocessor directive to embed code in your application that
is processed only by the debugger.
The DEBUG directive is frequently used during
testing. You do not usually enable the DEBUG directive in a release build, but if a
problem is reported in a production application, you can redeploy the release build
with the DEBUG directive enabled to help determine the nature or location of the
problem.
- Add a DEBUG block around the code that you want to preprocess. For example, to
paste a template into your code, right-click in the Script Editor and select .
- Rebuild your application.
- Determine how the DEBUG code is parsed at runtime:
- If you want the DEBUG code block to always be parsed, whether you run
the application in the development environment or from its executable file,
select Enable Debug Symbol in the General
page of the Project painter.
- To parse the DEBUG code block only when you run the application in the
development environment, unselect the DEBUG symbol.
- Debug the application to examine the results.
The block of conditional code is automatically parsed by the PowerBuilder preprocessor before it is
passed to the compiler.
You might add this DEBUG block of code to your application:
#if defined DEBUG then
MessageBox("Debugging","Ctr value is " + string(i))
#end if
This code is always parsed and you always see the message box when you run or debug
the application in the development environment. To see the message box when you run
the executable file, enable the DEBUG symbol in the Project painter.