Previous Application Programming: Distributing Runtime Mode Applications Next

Starting a Runtime Application

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 (creating 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 Exported IDL Distribution

If you have used the IDL Project interface or the make_rt script to create an IDL runtime distribution, give your users instructions describing how to start your application based on the following. The specifics depend on your end user's platform.

Windows

To start a runtime application if you have exported an IDL distribution using the IDL Project interface, change directories to the application\bin\bin.platform directory (where application is the name of the directory that contains your exported distribution and platform is the platform-specific bin directory) and double-click on the executable file created by the export process.


Note
The executable file must reside in the bin\bin.platform subdirectory of your exported application distribution. For your users' convenience, you may want to create a Windows shortcut to the executable file in another location.

UNIX

To start a runtime application if you have exported an IDL distribution using the IDL Project interface or the make_rt script, change directories to the application directory (where application is the name of the directory that contains your exported distribution) and execute the startup script file. The startup script file has the name specified in the Run Command field of the Project Options dialog or via the startcommand parameter to the make_rt script.

Using an Existing IDL Distribution

If you have not used the IDL Project interface or the make_rt script to create an IDL runtime distribution, but are instead 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 or create scripts to launch your application. The specifics depend on your end user's platform.

Windows

To start a runtime application if you have not exported an IDL distribution using the IDL Project interface, 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:

To simplify startup of your application, you may want to 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:

@ECHO OFF  
REM This batch file launches the IDL runtime application myapp  
cd C:\ITT\IDL63\bin\bin.x86  
idlrt C:\mydir\myapp.sav  

UNIX

To start a runtime application if you have not exported an IDL distribution using the IDL Project interface or make_rt script, first ensure that the environment variable IDL_DIR is set to the path to the main directory of the IDL installation. For example, if IDL is installed in /usr/local/itt/idl_6.3, you would set the IDL_DIR environment variable to this value. When the IDL_DIR environment variable is set, do one of the following:

To simplify startup of your application, you may want to 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/itt/idl_6.3  
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/itt/idl_6.3  
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:\ITT\IDL63\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:

  • 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
  •  

  • Under Microsoft Windows, if no SAVE file is specified, 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 .sav file

When the main procedure returns, IDL exits.

  IDL Online Help (March 06, 2007)