Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Conditional compilation – PB Docs 2019 – PowerBuilder Library

Conditional compilation – PB Docs 2019

Conditional
compilation

Description

The use of conditional compilation directives causes the
PowerBuilder preprocessor to parse blocks of code before they are passed
to the compiler.

Syntax

Parameter

Description

predefined_symbols

A predefined identifier or a combination of
predefined identifiers separated by AND or OR operators. In the
current release, you cannot use a user-defined
identifier.

action1, action2, action3

The action you want performed if the condition in the
previous statement was met.

Usage

Conditional compilation enables you to include PowerScript code for
a specific target type or set of target types in an application. You can
also include debug code in your application and specify in the Project
painter whether it will be included in your application’s executable
file.

The preprocessor substitutes blank lines for statements with a
leading number (#) sign character. It passes the code in the
action statements to the compiler or converts it to blank lines depending
on whether the condition in the previous preprocessor directive was
met.

The following table displays the predefined symbols, the project
types to which they correspond, and their effects on the code passed to
the compiler.

Predefined symbols

Target type

Code in this processing block

PBNATIVE

Standard PowerBuilder client-server or distributed
applications

Fully parsed for the standard application and
converted to blank lines for .NET targets.

PBWEBSERVICE

.NET Web Service component targets

Fully parsed for .NET Web Service targets and
converted to blank lines for all other targets.

DEBUG

All PowerBuilder standard and .NET
targets

When a project’s Enable DEBUG Symbol check box is
selected, code is fully parsed by the compiler and included in the
deployed application. The code is converted to blank lines when
the check box is cleared. The DEBUG symbol is always defined in
the development environment.

You can use the NOT operator to include code for all target types
that are not of the type that you specify, and you can use AND and
OR operators to combine symbols. For example, code that follows this
statement will be parsed for all targets except standard PowerBuilder
applications:

Comments can be added to conditional code blocks if they are
preceded by double slash marks ( // ) in the same line of code. You cannot
use the PowerScript line continuation character ( & ) in a conditional
code statement. You must use it in code that you embed in the conditional
block when you use more than one line for a single line of code.

Limitations and error
messages

Conditional compilation is not supported in DataWindow syntax, or in
structure or menu objects. You cannot edit the source code for an object
to include conditional compilation blocks that span function, event, or
variable definition boundaries.

You must rebuild your application after you add a DEBUG conditional
block.

The following table shows the types of error messages displayed for
incorrect conditional compilation code.

Error message

Description

Invalid if statement

#if statement without a defined symbol, with an
incorrectly defined symbol, or without a
then clause

#end if directive expected

#if statement without an #end if
statement

Unexpected preprocessor directive

Caused by an #else, #elseif, or #end if statement
when not preceded by an #if statement

Preprocessor syntax error

Caused by including text after an #else or
#end if statement when the text is not preceded by comment
characters (//)

Examples

When you run or debug the application in the development
environment, the following code is always parsed and you always see the
message box. When you run the executable file, the code is parsed only if
the DEBUG symbol is enabled on the General page in the Project
painter:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x