#include

InstallShield 2022 » InstallScript Language Reference

Use the #include statement to include the contents of another script in the main installation script. When you use #include, the compiler treats the additional source script as if it were part of the main installation script. Additional scripts, or include files, may contain variable declarations, other compiler directives, and program statements.

For example, you can create a separate file that contains all the user-defined constant definitions and then insert it into the script file using the #include statement. If you need to redefine any of the constants at a later date, they are all in one central location.

When you compile from the InstallShield interface, InstallShield searches for include script files in the following order:

1. The project’s script file directory
2. The directories that are specified in the Include Paths setting on the Compile/Link tab of the Settings dialog box
3. The InstallShield include directory

If two include files share the same name but they are stored in different locations, InstallShield links to the one that it finds first, according to the aforementioned order. In addition, if an include file is specified by a relative path, InstallShield searches for the path relative to the aforementioned directories, in order.

If the include file is not in any of these locations, specify a fully qualified file name in the #include statement. When using the #include statement, specify a file name or path by enclosing the file name or path in double quotation marks (“filename”).

Note the following details when you are using #include directives in your script:

InstallShield does not handle paths with more than 260 characters, including the file name.
InstallScript allows nesting of include files up to a maximum of eight levels.
The InstallShield preprocessor does not interpret a backslash character in an #include directive as a control character; when specifying a path, use a single backslash instead of double backslashes to separate folder names.
Do not include C language header files in the script. The InstallShield compiler does not recognize some of C’s constructs. Create header files using InstallScript only.

The following example shows a section of an installation script that uses the #include statement to include the contents of Support.rul and other files. Each of the source scripts referenced by the #include statements has been written for a specific purpose and is then added to the script when the script is compiled:

//The following include file contains installation-specific routines.

#include  "SUPPORT.RUL"

 

// Local include file containing variable and prototype declarations.

#include  "DECLARE.RUL"

 

 

// Include scripts from the LIBRARY directory

#include  "..\LIBRARY\SYSCHK.H"

 

// Include scripts from the DIALOGS directory.

#include  "..\DIALOGS\WELCOME\WELCOME.H"

#include  "..\DIALOGS\REGINS\REGINS.H"

#include  "..\DIALOGS\ICONS\ICONS.H"