PRB: VXD Containing Constant Data May Fail To Load in Windows 95/98

ID: Q199295


The information in this article applies to:
  • Microsoft Visual C++, 32-bit Editions, versions 4.2, 5.0, 6.0
    on the following platforms: Win95, Win98


SYMPTOMS

A VXD built in Visual C++ version 5.0 or later, may fail to load in the Windows 95 or Windows 98 operating system if it contains constant data.

The same VXD built with Visual C++ version 4.2 may not show this behavior.


CAUSE

The problem stems from differences in the way the compiler versions handle constant data. The 4.2 compiler erroneously grouped constant data with all other data. Hence, all data appeared in the LDATA section in the object.

Later compilers, starting with version 5.0, correctly treat constant data as separate read only data and place it in the .rdata section. Because of this, the VXD fails to load, unable to recognize the new section.


RESOLUTION

Use any one of the following two workarounds:

  • Add the following pragma in the source file where constant data is declared:



  • 
        #pragma const_seg("_LDATA") 

  • Add the following linker switch:



  • 
        /merge:.rdata=_LDATA 


STATUS

This behavior is by design.

Additional query words: kbDSupport

Keywords : kbCompiler kbVC500 kbVC600 kbWinOS95 kbWinOS98
Version : winnt:4.2,5.0,6.0
Platform : winnt
Issue type : kbprb


Last Reviewed: January 22, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.