You must provide your end users with instructions describing how to start your application. You may choose to provide users with the name and location of your application executable along with a launch command to execute, or (if you are using an installer for your application) with shell scripts, shortcuts, or Start menu items.
The application startup process differs depending on whether you are supplying an IDL runtime distribution (created using the IDL Project interface or the make_rt script) or are relying on your user to install a full (if potentially unlicensed) IDL distribution. The following sections describe the process for each of these situations.
Using an IDL Runtime Distribution
If you use the MAKE_RT procedure to create a runtime distribution, specifying a SAVE file for your application, application launch scripts for your application are created automatically. (You may need to modify the launch scripts.) If you do not use MAKE_RT, you can still create application launch scripts based on generic scripts included in the IDL distribution.
Using an Existing IDL Distribution
If you are relying on your end user to install an IDL distribution (licensed or not) before running your application, you can either give your users instructions based on the following information or create scripts to launch your application. The specifics depend on your end user’s platform.
Windows
To start a runtime application if you are not providing a runtime IDL distribution, either change directories to IDL_DIR\bin\bin.platform directory (where IDL_DIR is the main IDL directory and platform is the platform-specific bin directory) or ensure that this directory is included in the Windows PATH environment variable. Do one of the following:
- If your application runs in the IDL Virtual Machine, enter the following:
idlrt -vm=<path><filename>
If your application uses a runtime license, enter the following:idlrt <path><filename>
where <path> is the path to the SAVE file, and <filename> is the name of the SAVE file.
To simplify startup of your application, you can use the Windows launch script. Alternately, you can create a batch file that changes directories to the IDL bin directory and invokes idlrt with the SAVE file name. Such a batch file might look something like the following (you will need to substitute *** with your installation path):
@ECHO OFF
REM This batch file launches the IDL runtime application myapp
cd c:\Program Files\***\IDLxx\bin\bin.x86
idlrt C:\mydir\myapp.sav
UNIX/Mac
To start a runtime application if you are not providing a runtime IDL distribution, first ensure that the environment variable IDL_DIR is set to the path to the main directory of the IDL installation. When the IDL_DIR environment variable is set, do one of the following:
- If your application runs in the IDL Virtual Machine, enter the following:
idl -vm=<path><filename>
If your application uses a runtime license, enter the following:idl -rt=<path><filename>
where <path> is the path to the SAVE file, and <filename> is the name of the SAVE file.
To simplify startup of your application, you can use the UNIX or Mac launch script. Alternately, you can create a shell script that sets the IDL_DIR environment variable and calls IDL with the correct flag and SAVE file name. Such a script might look something like the following:
#!/bin/sh
# This script launches the IDL runtime application myapp
IDL_DIR=/usr/local/***/idlxx
idl -rt=/mydir/myapp.sav
Specifying Application Preferences at Startup
You can specify the values of IDL preferences in your startup command by including either the -pref command line option or by specifying individual preference values on the command line.
For example, suppose your application is installed in the directory /mydir. To have IDL load the preference values contained in a file named myapp.pref in the same directory when the application starts, you might modify your the UNIX startup script described above to read:
#!/bin/sh
# This script launches the IDL runtime application myapp
IDL_DIR=/usr/local/***/idlxx
idl -rt=/mydir/myapp.sav -pref=/mydir/myapp.pref
Similarly, to force a Windows runtime application to use software rendering, you could explicitly specify the preference value in a batch file that starts the application:
@ECHO OFF
REM This batch file launches the IDL runtime application myapp
cd C:\Program Files\***\IDLxx\bin\bin.x86
idlrt C:\mydir\myapp.sav -IDL_GR_WIN_RENDERER 1
See Preferences for Runtime Applications for details.
What Happens When IDL Runs Your Application
When you launch an IDL runtime application, IDL does the following:
- IDL restores the specified SAVE file, if one is specified at the command line or when creating the distribution via the IDL Project interface or make_rt script.
- On Windows, if no SAVE file is specified, IDL restores the SAVE file specified by the IDL_WIN_RT preference.
- If no SAVE file is specified, restores the file runtime.sav
IDL then calls the main procedure. This is one of the following:
- A procedure named main in the restored SAVE file
- A procedure with the same name as the SAVE file
When the main procedure returns, IDL exits.