Internal: How To Make .sav Applications Based On IDL 6.0's iTools
Anonym
Topic:
[IMPORTANT NOTE FOR USERS OF IDL 6.1 OR GREATER: The
IDLITRESOLVEITOOLS procedure discussed in this Tech Tip has been replaced by a new procedure named
ITRESOLVE. Please see your current IDL Online Help for
ITRESOLVE for further details.]
Many users have asked how iTools might be incorporated into a distributable IDL .sav application. This question is particularly important for developers, who are trying to create applications that will run in IDL Runtime (idlrt[.exe]) or in the IDL Virtual Machine. A critical step to accomplishing this is that all necessary iTools subroutines needed by your main iTools procedure must be resolved in your IDL build environment before the .sav file is created. This Tech Tip shows two simple ways to accomplish this.
For more general information on creating .sav files in IDL Projects see 'Part III: Creating Applications in IDL -> Creating IDL Projects' in RSI's "Building IDL Applications" manual (building.pdf).Discussion:
Although it is not in the iTools documentation for version 6.0 IDL, the iTools development team actually included a helper routine for resolving all the iTools subroutines needed for any iTools binary. With this routine, a single command at the IDL command line or, alternatively, in an IDL project's build options can create the build environment that the developer needs. The routine is called 'IDLitResolveItools' and is located in a .pro file of the same name in the
[IDL_DIR]/lib/itools/framework/ directory. (
Note: Because this routine is not yet documented, the name and location may change in future IDL versions.) If you were to run "IDLITRESOLVEITOOLS" at the command line, it would "quietly" compile all the class files used by iTools in the [IDL_DIR]/lib/ directory into your current IDL process environment. Note that this process might take 30-60 seconds or more depending on your processor speed.
To illustrate our two simple approaches we will use the example that the user's Main program is a procedure
iplotfindgen100.pro that contains one line of code:
PRO iplotfindgen100
iplot, findgen(100)
END
Let us assume that this custom-made procedure is in the current IDL search path. Follow these steps, then, to complete the job of creating an iplotfindgen100.sav application that can be opened on any IDL Virtual Machine.
Building The Binary At The IDL Command Line
IDL> .FULL_RESET_SESSION
IDL> .COMPILE iplotfindgen100
IDL> RESOLVE_ALL
IDL> IDLITRESOLVEITOOLS
IDL> SAVE, /ROUTINES, FILENAME='iplotfingen100.sav'
Building The Binary Using IDL Projects
You can set up a .sav file built in IDL Projects to do the same as the above with the steps shown below.
- Open the 'idlde' IDL Development Environment.
- Select File->New->Project... from the top-level menu.
- Insert in the 'File name' field the name "iplotfindgen100". A project file named 'iplotfindgen100.prj' will be inserted in the current directory shown on that dialog.
- Select Project->Add/Remove Files... from the top-level menu.
- Browse to iplotfindgen100.pro, select it into the 'File name' field, and hit 'OK'. 'iplotfindgen100.pro' should appear in the 'Source' branch of your 'iplotfindgen100.prj' tree.
- Select Project->Options..., and the 'Project Options' dialog will open up.
- Choose the 'Save File (.sav)' radio button on that dialog.
- Enter in the 'Build Command' field that critical Itool compiling command "idlitresolveitools".
- Hit 'OK' to close the 'Project Options' dialog.
- Select File->Save Project from the top-level menu.
- Important! Select Project->Compile->All Files from the top-level menu. This is the only way to get the 'Build Command' in step 8 above to execute. (Project->Build does not execute the 'Build Command' as many might expect.) Note: this step might tie up the IDLDE for 30-60 seconds or more.
- Now Select Project->Build from the top-level menu. Important! When the Resetting Entire IDL Session message box appears, Hit Cancel!
The last step will build the binary and insert it as iplotfindgen100.sav in the directory shown in the 'Path' field on the Project->Options... dialog.The best test that this approach has worked properly is:
- First, make sure that your .sav binary file is not suspiciously small. If it is less than a few MB in size, then you probably missed one of the details in the above steps. You should check steps 11 and 12 particularly closely, and rexecute at least those two steps, if not the complete set of steps, over again.
- in Windows: Drag the 'iplotfindgen100.sav' file onto an IDL Virtual Machine icon
- in UNIX: Type "idl -vm=/explicit/path/to/iplotfindgen100.sav" at the shell command prompt.
Solution:
[Edit this field in the IDL-based Tech Tip Editor, v60]