PDA

View Full Version : error FRT2223:


R. T. (Fortran Man)
08-25-2003, 09:07 PM
I get the Fortran for .NET compiler error "FRT2223: procedure not correctly referenced" when I try to compile the following code. What is the problem?

program FRT2223
integer, pointer :: BranchInfo
CALL READN(BranchInfo)
END
SUBROUTINE READN(BranchInfo)
integer, pointer :: BranchInfo
RETURN
END

Lahey Support
08-26-2003, 05:50 AM
This error is occurring because whenever a call is made to a subprogram with a dummy argument that has the pointer attribute, and interface is required in the calling program.
An interface can be provided by specifying an interface block:

program FRT2223
interface
subroutine READN(i)
integer, pointer :: i
end subroutine
end interface
integer, pointer :: BranchInfo
CALL READN(BranchInfo)
END
SUBROUTINE READN(BranchInfo)
integer, pointer :: BranchInfo
RETURN
END

or by encapsulating the subroutine within a module, which makes an interface available by use association:

PROGRAM FRT2223
use readnmod
integer, pointer :: BranchInfo
call READN(BranchInfo)
END

MODULE readnmod
contains
SUBROUTINE READN(BranchInfo)
integer, pointer :: BranchInfo
return
END SUBROUTINE
END MODULE