Here's a problem I haven't been able to figure out: is there a way to create a
generic interface for CONTAINed routines?
SUBROUTINE foo ( ... )
implicit none
! interface block?
integer i, j
real x, y
i = 2
y = 3.5
CALL bar( i, x ) ! I want this to resolve to BAR_INT_REAL
call bar( y, j ) ! I want this to resolve to BAR_REAL_INT
CONTAINS
SUBROUTINE bar_int_real( a, b )
INTEGER, INTENT(IN) :: a
REAL, INTENT(OUT) :: b
b = a**2
END SUBROUTINE bar_int_real
SUBROUTINE bar_real_int( a, b )
REAL, INTENT(IN) :: a
INTEGER, INTENT(OUT) :: b
b = a**2
END SUBROUTINE bar_real_int
END SUBROUTINE foo
Since the routines are CONTAINed, is there a form analogous to
INTERFACE bar
module procedure bar_int_real
module procedure bar_real_int
END INTERFACE
that I should put at the top of the subroutine? "module procedure" itself is
not correct, at least on the compilers I've tested with. It seems like there
should be an implicit interface already available because the routines are
CONTAINed.
Usually I would handle this situation by putting the routines in a separate
module and making the generic interface there, but there are performance
tuning situations requiring inlining that I would like to handle using
CONTAINS instead.
Ted
--
============================================================
Ted Stern Engineering Applications
Cray Inc. http://www.cray.com
411 First Avenue South, Suite 600 206-701-2182
Seattle, WA 98104-2860 FAX: 206-701-2500
============================================================
|