Microsoft KB Archive/199295

= A VXD that was built in Visual C++ version 5.0 or a later version may fail to load in Windows 95 or Windows 98 if the VXD contains constant data =

Article ID: 199295

Article Last Modified on 1/11/2006

-

APPLIES TO

 Microsoft Visual C++ 4.2 Enterprise Edition, when used with:  Microsoft Windows 95

 Microsoft Windows 98 Standard Edition  Microsoft Visual C++ 5.0 Enterprise Edition, when used with:  Microsoft Windows 95

 Microsoft Windows 98 Standard Edition</li></ul> </li> Microsoft Visual C++ 6.0 Enterprise Edition, when used with:  Microsoft Windows 95</li></ul>

 Microsoft Windows 98 Standard Edition</li></ul> </li> Microsoft Visual C++ 4.2 Professional Edition, when used with:  Microsoft Windows 95</li></ul>

 Microsoft Windows 98 Standard Edition</li></ul> </li> Microsoft Visual C++ 5.0 Professional Edition, when used with:  Microsoft Windows 95</li></ul>

 <li>Microsoft Windows 98 Standard Edition</li></ul> </li> <li>Microsoft Visual C++ 6.0 Professional Edition, when used with: <ul> <li>Microsoft Windows 95</li></ul>

<ul> <li>Microsoft Windows 98 Standard Edition</li></ul> </li> <li>Microsoft Visual C++ 6.0 Standard Edition, when used with: <ul> <li>Microsoft Windows 95</li></ul>

<ul> <li>Microsoft Windows 98 Standard Edition</li></ul> </li> <li>Microsoft Visual C++ .NET 2002 Standard Edition, when used with: <ul> <li>Microsoft Windows 98 Standard Edition</li></ul> </li> <li>Microsoft Visual C++ 2005 Express Edition, when used with: <ul> <li>Microsoft Windows 95</li></ul>

<ul> <li>Microsoft Windows 98 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q199295

<div class="symptoms_section">

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.

<div class="cause_section">

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.

The Visual C++ .NET Linker issues an LNK4212 warning for this condition.

<div class="resolution_section">

RESOLUTION
Use any one of the following two workarounds:

<ul> <li> 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 </li></ul>

<div class="status_section">

STATUS
This behavior is by design.

Additional query words: kbDSupport

Keywords: kbtshoot kbprb kbcompiler KB199295

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.