IMPORT (Fortran 2003)

Purpose

Named entities from the host scoping unit are not accessible in an interface body that is not a module procedure interface body. The IMPORT statement makes those entities accessible in such interface body by host association. The IMPORT statement is not valid in a module procedure interface body.

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 with the exception of the module procedure 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
......


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us