Inno Setup Preprocessor: #define

Inno Setup Preprocessor

Inno Setup Preprocessor: #define

Syntax

define-directive: <variable-definition>
<macro-definition>
<default-visibility-set>
variable-definition: (define | :) [private | protected | public] <ident> [[ <expr> ]] [[=] <expr>]
macro-definition: (define | :) [private | protected | public] <ident> ( [<formal-macro-args>] ) <expr>
default-visibility-set: (define | :) private | protected | public
formal-macro-args: <formal-macro-arg> [, <formal-macro-arg>]...
formal-macro-arg: <by-val-arg> | <by-ref-arg>
by-val-arg: [<type-id>] <ident> [= <expr>]
by-ref-arg: [<type-id>] * <ident>
type-id: any | int | str | func

Description

The first syntax ("variable-definition") defines a variable named ident, or assigns a value to an element of an array named ident. If none of the public, protected, or private keywords are specified, default visibility is assumed.

The second syntax ("macro-definition") defines a macro named ident. When defining a macro there must be no whitespace between macro name and opening parenthesis, otherwise it will be treated as variable declaration.

The third syntax ("default-visibility-set") sets the default visibility of further variable and macro definitions in this file. If no visibility declaration occurs in a file, public visibility is assumed by default.

Examples

#define MyAppName "My Program"
#define MyAppVer GetFileVersion("MyProg.exe")
#define MyArray[0] 15
#define Multiply(int A, int B = 10) A * B

See also

dim, undef, Visibility of Identifiers.