Using the NEAR Attribute with FORTRAN COMMON Blocks (60079)
The information in this article applies to:
- Microsoft FORTRAN Compiler for MS-DOS 4.0
- Microsoft FORTRAN Compiler for MS-DOS 4.01
- Microsoft FORTRAN Compiler for MS-DOS 4.1
- Microsoft FORTRAN Compiler for MS-DOS 5.0
- Microsoft FORTRAN Compiler for MS-DOS 5.1
- Microsoft FORTRAN compiler for OS/2 4.1
- Microsoft FORTRAN compiler for OS/2 5.0
- Microsoft FORTRAN compiler for OS/2 5.1
This article was previously published under Q60079 SUMMARY
Page 34 of the Microsoft FORTRAN "Advanced Topics" manual includes a
discussion of using the NEAR attribute with a COMMON block. By
default, in Microsoft FORTRAN each COMMON block is placed into its own
data segment to save space in the default data segment (DGROUP). The
drawback to this method is that a far pointer is required to access
data from a COMMON block which makes the compiled code larger and
slower. To address this problem, use the NEAR attribute with small,
frequently accessed COMMON blocks. To use this technique, sufficient
space must be available in the default data segment.
When an application uses the NEAR attribute with a COMMON block, the
data in each COMMON block may appear to remain in its own segment,
rather than in the DGROUP segment when you use the /Fs compiler option
switch to create a source listing. This may be confusing when space is
obviously available in the default data segment for information in the
COMMON block. To verify that a NEAR COMMON block is concatenated to
the default data segment, view an object listing or a map listing. (To
create an object listing, specify the /Fl compiler option switch; to
generate a map listing, specify the /Fm compiler option switch.)
| Modification Type: | Major | Last Reviewed: | 12/1/2003 |
|---|
| Keywords: | KB60079 |
|---|
|