Inno Setup Preprocessor: #define

Inno Setup Preprocessor

Inno Setup Preprocessor: #define


define-directive: <variable-definition>
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


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.


#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.