# 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.

Parent topic: Associate a Procedure with Defined I/O

## See Also

TYPE Statement (Derived Types)
Defining Generic Names for Procedures