Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Generic Interface Block

A generic interface block can be used to associate procedures with defined I/O. The generic identifier should be the defined-io-generic-spec (see Defined IO Procedures). This is the only option for sequence or BIND(C) types.

Consider the following:

MODULE EXAMPLE 

TYPE LIST
INTEGER :: X
END TYPE   

INTERFACE READ (FORMATTED)
MODULE PROCEDURE R1
END INTERFACE  

CONTAINS   

     SUBROUTINE R1 (DTV, UNIT, IOTYPE, V_LIST, IOSTAT, IOMSG)
     CLASS(LIST), INTENT(INOUT) :: DTV
     INTEGER, INTENT(IN) :: UNIT
     CHARACTER(*), INTENT(IN) :: IOTYPE
     INTEGER, INTENT(IN) :: V_LIST(:)
     INTEGER, INTENT(OUT) :: IOSTAT
     CHARACTER(*), INTENT(INOUT) :: IOMSG
        READ (UNIT, FMT=*, IOSTAT=IOSTAT, IOMSG=IOMSG) DTV%X
     END SUBROUTINE R1
 
END MODULE EXAMPLE

In the above example, R1 is the READ (FORMATTED) defined I/O procedure.

If an object of type LIST is an effective item in a formatted READ statement, R1 will be called.