IDL: Call_external demo for Fortran for Solaris [message #3605] |
Thu, 16 February 1995 10:40 |
gallery
Messages: 4 Registered: August 1994
|
Junior Member |
|
|
Although I have been able to get the demo "test_ftn_only" to run under
Solaris, it gives the wrong answer for the sum of the array (Fortran gives
3.65, IDL TOTAL function gives 207.35.) RSI suggested using the fortran
compiler flag -fsingle, but this flag is not an option on my version of f77.
Has anyone been able to run it successfully?
Setup:
IDL. Version 3.6 (sunos sparc).
Workstation type: sparc (sun4m)
Operating System: SunOS Release 5.4 Generic Patch (Solaris 2.4)
Window System:OpenWindows Version 3.3
f77 version 3.0.1
Note: in ftn_only.pro, call_external needed to call "ftn_only_", not
"_ftn_only_".
The contents of my version of SOLARIS.Makefile follows:
------------------------------------------------------------ ------------------
# $Id: SOLARIS.Makefile,v 1.1 1993/11/16 23:36:16 idl Exp $
#
# NAME:
# SOLARIS.Makefile
#
# PURPOSE:
# This makefile is used to compile and run the call_external example
# routines on a Solaris system. This makefile has several entry
# points which are:
#
# test_c_only - Uses C functions only
#
# clean - Deletes shareable libraries and object files
#
# tidy - Deletes only the object files
#
# If no target is specified, the test_c_only example will be built
# if needed and run.
#
# CATEGORY:
# Dynamic Link
#
# CALLING SEQUENCE:
# This makefile should not be run directly, but through the use
# of the shell script make_callext_demo. This script determines
# what system the user is on and calls the correct makefile for
# that system.
#
# EXAMPLE:
# To run the C only examples, the following command would be issued
# while in the dynamic_link directory:
#
# % make_callext_demo
#
# SIDE EFFECTS:
# This file will take actions to build the sharable image library
# files that are dynamically loaded by IDL and then run a
# demo IDL procedure to show the operations used to link to and
# call an external routine.
#
# RESTRICTIONS:
# Unless the operator is sure of the type of system they are on
# they should not call this makefile directly. They should use
# the supplied shell script make_callext_demo.
#
# This makefile only provides examples calling C routines via
# the IDL call_external routine. A Fortran compiler was unavailable
# for testing so the Fortran examples are not implimented for
# this operating system.
#
# This makefile is written for a Sun Solaris operating system.
#
# MODIFICATION HISTORY:
# Written October, 1993 KDB
#
# Declare a macro for the location of IDL. The user might have to EDIT this
IDL = /optidl/idl
# Declare the c_only required files
C_ONLY_OBJS = simple.o \
double_array.o \
string_array.o
C_ONLY_SRCS = simple.c \
double_array.c \
string_array.c
C_ONLY_LIBS = simple.so \
double_array.so \
string_array.so
# Declare the C to Fortran and Fortran files
C2F_OBJS = simple_c2f.o simple_c2f1.o
C2F_SRCS = simple_c2f.c simple_c2f1.f
F_OBJS = ftn_only_sun.o ftn_strarr_sun.o
F_SRCS = ftn_only_sun.f ftn_strarr_sun.f
IDL_SRCS = c_only.pro simple_c2f.pro ftn_only.pro
# The sun loader needs the fortran libraries. You might have to EDIT these
# locations for your system.
OPT_FTN_LIBS = /opt/SUNWspro/SC3.0.1/lib/libF77.a \
/opt/SUNWspro/SC3.0.1/lib/libmopt.a \
/opt/SUNWspro/SC3.0.1/lib/libsunmath.a
# Declare compiler flags
C_FLAGS = -c -Kpic -G
F_FLAGS = -c -pic -f
# Declare the makefile main target, used to test C only routines
test_c_only: $(C_ONLY_LIBS)
echo c_only | $(IDL) | more
test_c2fort: simple_c2f.so
echo simple_c2f | $(IDL) | more
test_ftn_only: ftn_only.so
echo ftn_only | $(IDL) | more
# Build the C only libraries
$(C_ONLY_LIBS): $(C_ONLY_SRCS)
cc $(C_FLAGS) $(C_ONLY_SRCS)
cc -G -o simple.so simple.o
cc -G -o double_array.so double_array.o
cc -G -o string_array.so string_array.o
# Declare a target for the routines that require a fortran compiler
simple_c2f.so: $(C2F_SRCS)
cc $(C_FLAGS) simple_c2f.c
f77 $(F_FLAGS) simple_c2f1.f
ld -G -o simple_c2f.so $(C2F_OBJS) $(OPT_FTN_LIBS)
ftn_only.so: $(F_SRCS)
f77 $(F_FLAGS) $(F_SRCS)
ld -G -o ftn_only.so ftn_only_sun.o $(OPT_FTN_LIBS)
ld -G -o ftn_strarr.so ftn_strarr_sun.o $(OPT_FTN_LIBS)
# Declare a target to delete all libraries and object files created.
clean: tidy
rm -f simple.so double_array.so string_array.so
# Declare a target to delete all the object files created.
tidy:
rm -f $(C_ONLY_OBJS)
------------------------------------------------------------ ----------
--
William O. Gallery gallery@aer.com
Atmospheric & Environmental Research Voice(617) 349-2284
840 Memorial Drive (617) 547-6207
Cambridge, Massachusetts 02139 FAX (617) 661-6479
|
|
|