F2225, NEAR/FAR Attribute MismatchLast reviewed: July 17, 1995Article ID: Q48787 |
The information in this article applies to:
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] () endThis 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 reference words: kbinf 4.00 4.10 5.00 5.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |