BUG: #pragma data_seg May Cause L1101 Error

Last reviewed: July 18, 1997
Article ID: Q128553
1.50 1.51 1.52 WINDOWS kbtool kbbuglist

The information in this article applies to:

  • The Microsoft Linker (LINK.EXE), included with: Microsoft Visual C++ for Windows, versions 1.5, 1.51, 1.52

SYMPTOMS

When you use #pragma data_seg() to name a data segment and the module includes a character pointer initialized to point to a string constant, the linker reports this fatal error:

   test.obj(test.c) : fatal error L1101 : Invalid Object Module
   Object file offset: xxx Record type: a0

NOTE: The error does not occur if the character pointer is not initialized.

RESOLUTION

Here are two possible workarounds:

  • Use an array to set the initial value for the string. Then assign the address of the array to the pointer variable. This is demonstrated in the sample code below.

    -or-

  • Use the /ND"data_seg_name" compiler switch to name the data segment instead of using #pragma data_seg() in the code.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Sample Code to Reproduce Problem

/* Compile options needed: none
*/

#pragma data_seg("TEST_DATA")

/* comment out this line to avoid the error */
char *pszMsg="L1101";

/* uncomment the following section and use it as a work-around */

/*
char achMsg[] = "L1101";
char __far *pszMsg = achMsg;
*/

void main()
{ }


Additional reference words: 1.50 1.51 1.52 5.6 5.60 5.60.220 5.60.339
KBCategory: kbtool kbbuglist
KBSubcategory: LinkIss
Keywords : kb16bitonly LinkIss kbbuglist kbtool
Version : 1.50 1.51 1.52
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.