F2225, NEAR/FAR Attribute Mismatch
ID: Q48787
|
The information in this article applies to:
-
Microsoft FORTRAN for MS-DOS, versions 4.0, 4.1, 5.0, 5.1
-
Microsoft FORTRAN for OS/2, versions 4.0, 4.1, 5.0, 5.1
SUMMARY
When using FORTRAN in the large model and calling a subroutine that is
declared as NEAR, error F2225 "NEAR/FAR attribute mismatch" is
generated if no INTERFACE statement exists for that subroutine.
When the compiler passes a CALL instruction in a large model FORTRAN
program, it reserves 4 bytes for the address of the subroutine. If you
use the NEAR attribute on the subroutine, only 2 bytes are needed for
the subroutine address.
The problem occurs because the compiler assumes the subroutine is type
FAR if the compiler reaches the call to the subroutine before the
subroutine declaration. If you then specify the subroutine as NEAR,
you get the attribute mismatch error.
To eliminate this mismatch, you must use the interface statement at
the beginning of the file to explicitly define the subroutine as NEAR,
as shown in the following example:
interface to subroutine mysub [NEAR] ()
end
This procedure lets the compiler know that when it comes across a call
to the subroutine mysub, two bytes should be reserved for the address
instead of four bytes.
Additional query words:
kbinf nofps 4.00 4.10 5.00 5.10
Keywords :
Version : :4.0,4.1,5.0,5.1
Platform :
Issue type :
|