Microsoft KB Archive/104038

From BetaArchive Wiki

FIX: #pragma code_seg Classification Problem with /f- PSS ID Number: Q104038 Article last modified on 12-21-1993

7.00

MS-DOS

The information in this article applies to:
- Microsoft C/C++ for MS-DOS, version 7.0

SYMPTOMS

When using the #pragma code_seg preprocessor directive to specify a segment where functions are to be allocated, the Microsoft C/C++ compiler version 7.0 does not properly classify the code segment when the object module is compiled with /f- or any optimization.

The #pragma code_seg preprocessor directive allows an optional parameter to give a name to the class of the code segment specified. See page 210 of the “C Language Reference” manual for more information on the #pragma code_seg directive.

When the /Fc compile option is used to create a .COD file with mixed source and assembly, it apparently properly creates the named code segment with the class name specified in the #pragma code_seg statement; however, the class name does not carry over when linking, as the map file created by the linker map will show.

For more information on linker map files, see page 583 of the “Environment and Tools” manual.

RESOLUTION

The proper class is generated when the /f compile switch is used to force the fast version of the compiler to be run. Even though /f is a default option for the compiler, when an optimization is used, it forces use of the /f- to run the full optimizing compiler. Using /f ensures that the proper classification is used.

STATUS

Microsoft has confirmed this to be a problem in C/C++ version 7.0. This problem was corrected in C/C++ version 8.0, which is included with Visual C++ for Windows, version 1.0

Additional reference words: 7.00 KBCategory: Tls KBSubCategory:

=================================================================

Copyright Microsoft Corporation 1993.