Compiling Callable IDL (from Fortran)

To compile your Fortran program that calls a C wrapper, which in turn calls the IDL plotting program, you must first, at the very least source the IDL directory:

source $IDL_DIR/bin/idl_setup
Then after compiling (easiest to do with a Makefile), you must set some environment variables, then run.

Perhaps the best way to accomplish these tasks is to have a .idlrc script that is sourced before compiling, then another script that executes the .idlrc script, compiles the Makefile, and finally, runs the program.

For links to examples of these scripts and Makefiles, click on the appropriate link below:

Numerous variations on the theme are possible, but ultimately the following lines must be fed to the computer:

Before compiling:

source $IDL_DIR/bin/idl_setup
To compile (SGI version given as an example):

MODULE = align
WRAPPER = callable_wraps


LDFLAGS= -L$(BINDIR) -lMesaGLU  -lMesaGL -lidl -lXm -lXt \
        /usr/lib/fixade.o -lX11 -ltermcap -lm -lfpe -lc

CFLAGS = -o32 -I$(IDL_DIR)/external

 f77 -o32 -o $(MODULE) $(MODULE).o $(WRAPPER).o $(LDFLAGS)

$(MODULE).o: $(MODULE).f
 f77 -o32 -c $(MODULE).f

 cc -I$(IDL_DIR)/external -o32 -c $(WRAPPER).c

Before executing (but may also occur before compiling):
setenv IDL_DIR /itl/apps/idl-5.1/idl_5.1
setenv LD_LIBRARY_PATH /itl/apps/idl-5.1/idl_5.1/bin/bin.sgi
setenv LM_LICENSE_FILE /itl/apps/licenses/license.dat/idl
To run: