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.1In 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.
BIN_DIR=$(IDL_DIR)/bin/bin.sgiLDFLAGS= -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) -lcalign.o: align.f
f77 -o32 -c align.fwrapalign.o: wrapalign.c
cc -I/itl/apps/idl-5.1/idl_5.1/external -o32 -c wrapalign.cclean:
rm *.o align
To compile, type:
make alignon 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 -fIn my example, I saved this script with the name "doalign." So, after making "align," type
setenv IDL_DIR /itl/apps/idl-5.1/idl_5.1
setenv LM_LICENSE_FILE $IDL_DIR/../license/license.dat
exec align $argv
doalignon the UNIX command line.