You can create binary files containing data variables, system variables, functions, procedures, or objects using the SAVE procedure. These SAVE files can be shared with other users who will be able to execute the program, but who will not have access to the IDL code that created it. Variables that are used from session to session can be saved as and recovered from a SAVE file.
Tip: A startup file can be set up to execute the RESTORE command every time IDL is started.
Note: Files containing IDL routines and system variables can only be restored by versions of IDL that share the same internal code representation. Since the internal code representation changes regularly, you should always archive the IDL language source files (.pro files) for routines you are placing in IDL SAVE files so you can recompile the code when a new version of IDL is released.
What Can be Stored in a SAVE File
A SAVE file can contain system variables, data variables, or named program files. See the following topics for details:
- Named routines: Store one or more routines in a single SAVE file and distribute it other IDL users.
- Variable data: Store system or session variable data in a SAVE file.
Note: Variables and routines cannot be stored in the same SAVE file.
Save Files and Application Development
For distributable applications, IDL does not compile .pro files. Therefore, any procedures or functions used by an application must be resolved and contained in a SAVE file. For IDL applications, these routines can be part of the main SAVE file that is restored when your application is started. The following are examples of cases in which you might use SAVE to create .sav files:
- To create SAVE files for any procedures or functions that are not contained in the main SAVE file that is restored when a native IDL application is started
- To create SAVE files for any procedures or functions used by a Callable IDL application
- To create SAVE files for any variables used by your application, such as custom ASCII templates
Accessing and Running SAVE Files
Depending upon the name and contents of the SAVE file, there are a number of ways to restore the file. SAVE files containing routines can be executed in a fully licensed version of IDL, through the IDL Virtual Machine (if created in IDL version 6.0 or later), or using the IDL_Savefile object. SAVE files containing variable data can be restored using the RESTORE procedure or the IDL_Savefile object. You may also be able to automatically compile and restore the file by typing the name of the file at the command line. See Executing SAVE Files for details.