-qextern

Category

Portability and migration

@PROCESS

None.

Purpose

Allows user-written procedures to be called instead of XL Fortran intrinsics.

Syntax

Read syntax diagramSkip visual syntax diagram
>>- -q--extern--=--names---------------------------------------><

Defaults

Not applicable.

Parameters

names
A list of procedure names separated by colons.

Usage

The procedure names are treated as if they appear in an EXTERNAL statement in each compilation unit being compiled. If any of your procedure names conflict with XL Fortran intrinsic procedures, use this option to call the procedures in the source code instead of the intrinsic ones.

Because of the many Fortran 90 and Fortran 95 intrinsic functions and subroutines, you might need to use this option even if you did not need it for FORTRAN 77 programs.

Examples

       subroutine matmul(res, aa, bb, ext)
         implicit none
         integer ext, i, j, k
         real aa(ext, ext), bb(ext, ext), res(ext, ext), temp
         do i = 1, ext
           do j = 1, ext
             temp = 0
             do k = 1, ext
               temp = temp + aa(i, k) * bb(k, j)
             end do
             res(i, j) = temp
           end do
         end do
       end subroutine

       implicit none
       integer i, j, irand
       integer, parameter :: ext = 100
       real ma(ext, ext), mb(ext, ext), res(ext, ext)

       do i = 1, ext
         do j = 1, ext
           ma(i, j) = float(irand())
           mb(i, j) = float(irand())
         end do
       end do

       call matmul(res, ma, mb, ext)
       end

Compiling this program with no options fails because the call to MATMUL is actually calling the intrinsic subroutine, not the subroutine defined in the program. Compiling with -qextern=matmul allows the program to be compiled and run successfully.