Compiling Callable IDL (from Fortran)

When compiling Fortran code that calls IDL to plot graphs, you'll need a C wrapper.  For examples of the code, click here.   For an example of the make files and scripts for a SGI or a Sun, click on the list below.
 

You will need a Makefile, and an example for an SGI is:

L_MALLOC = -lidl_gmalloc
IDL_DIR=/itl/apps/idl-5.1/idl_5.1
BIN_DIR=$(IDL_DIR)/bin/bin.sgi

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

CFLAGS = -I$(IDL_DIR)/external

align:  align.o wrapalign.o
 f77 -o32 -o align align.o wrapalign.o $(LDFLAGS) -lc

align.o: align.f
 f77 -o32 -c align.f

wrapalign.o: wrapalign.c
 cc -I/itl/apps/idl-5.1/idl_5.1/external -o32 -c wrapalign.c

clean:
 rm *.o align

In this case, the fortran program is "align.f" which calls the C-wrapper, "wrapalign.c."  It is wrapalign.c which calls IDL and produces the graph.

To compile, type:

make align
on the UNIX command line.

Once the executeable has been produced, "align," you cannot simply type "align" on the command line.  You instead must run a script that sets the environment.  Here is an example:

#!/bin/csh -f
setenv IDL_DIR /itl/apps/idl-5.1/idl_5.1
setenv LM_LICENSE_FILE $IDL_DIR/../license/license.dat
exec align $argv
In my example, I saved this script with the name "doalign."  So, after making "align," type
doalign
on the UNIX command line.