Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Generic Bindings

User-defined I/O procedures can be type-bound procedures that use a defined-io-generic-spec (see Defined IO Procedures).

Consider the following:

TYPE LIST
TYPE(NODE), POINTER :: FIRST
CONTAINS
PROCEDURE :: FMTREAD => LIST_FMTREAD
PROCEDURE :: FMTWRITE => LIST_FMTWRITE
GENERIC,PUBLIC :: READ(FORMATTED) => FMTREAD 
GENERIC,PUBLIC :: WRITE(FORMATTED) => FMTWRITE
END TYPE LIST

In the above example, LIST_FMTREAD and LIST_FMTWRITE are the type-bound defined I/O procedures. If an object of type LIST is an effective item in a formatted READ statement, LIST_FMTREAD will be called to perform the read operation.