Fanning Software Consulting

Compiling IDL Run-Time Object Code

QUESTION: I'm using some graphics objects in my code, as well as a couple of objects I created myself. These work great when I run my application from the IDL command line, but I can't seem to get my IDL run-time application working. It seems the first object created is always a NULL object. What is going on?

ANSWER: The problem with run-time applications that use objects (of any sort) is that you have to go to special care to be sure the code is compiled when you create the run-time save file. Normally with run-time applications we run the program, then type Resolve_All to get all the procedures and functions we need compiled, save everything as a Save file, and off we go.

But Resolve_All doesn't resolve everything. And in particular it doesn't resolve object references. To get around this, I tend to create make files that specifically compile my object code in the process of creating my run-time save file.

A typical make file might look like this.

   .Compile myNeatProgram     ; My real program
   Resolve_All                ; All the library routines, etc.
   .Compile trackball__define ; The trackball object I will be using.
   .Compile vcolorbar__define ; The vertical colorbar object I will be using.
   Save, /Routines, File='myNeatProgram.sav' ; The save file for run-time.

Now I have a save file that will work fine as a run-time application.

[Editor's Note: In IDL 6.0 a CLASS keyword was added to Resolve_All that will allow you to specify the name of an object or objects that should be compiled. This assumes that you have named your file correctly, and that the object's definition module is the last module in a file of the same name (i.e,.]

If you are trying to compile code that uses iTool functionality, then you have an even bigger problem. You won't know, probably, which iTool objects should be compilied. Short of chasing them down one by one, a process that could take a week or more, what you have to do is compile the entire iTool library. This is done with the ITTVIS-supplied tool ITResolve. (Note that this tool has been renamed IResolve starting with IDL 7.1.) The negative consequence of this is that your IDL save file will suddenly grow in size by a factor of 10 or more. After you have spent a few fruitless hours chasing the problem, though, this will seem like pretty small potatoes to you.

Web Coyote's Guide to IDL Programming