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