IMPORT (Fortran 2003)

Purpose

The IMPORT statement makes named entities from the host scoping unit accessible in the interface body by host association.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-IMPORT--+--------------------------+------------------------><
           '-+----+--import_name_list-'   
             '-::-'                       

import_name_list
is a list of named entities that are accessible in the host scoping unit

Rules

The IMPORT statement is allowed only in an interface body. Each of the specified names must be explicitly declared before the interface body.

The entities in the import name list are imported into the current scoping unit and are accessible by host association. If no names are specified, all of the accessible named entities in the host scoping unit are imported.

The names of imported entities must not appear in any context that would cause the host entity to be inaccessible.

Examples

use, intrinsic :: ISO_C_BINDING
interface
  subroutine process_buffer(buffer, n_bytes), bind(C,NAME="ProcessBuffer")
     IMPORT :: C_PTR, C_INT
     type (C_PTR), value :: buffer
     integer (C_INT), value :: n_bytes
  end subroutine process_buffer
end interface
......

Related information