ID: Q123989
1.00 1.50 | 7.00
WINDOWS | MS-DOS
kbtool kberrmsg kbprb
The information in this article applies to:
The Resource Compiler (RC.EXE) included with:
- Microsoft C/C++ for MS-DOS, version 7.0
- Microsoft Visual C++ for Windows, versions 1.0 and 1.5
The following error is generated by the resource compiler (RC):
warning RW4005: Segment XX (offset XXXX) contains a
relocation record pointing to the automatic data segment.
This will cause the program to crash if the instruction being
fixed up is executed in a multi-instance application. If this
fixup is necessary, the program should be restricted to run
only a single instance.
This error results when a fix-up record attempts to fix DGROUP, the data segment created by the C run-time, in the code segment of an application that might have multiple instances. Because Windows version 3.1 cannot fix locations that are different from instance to instance in shared code segments, this error is generated.
Here are five possible causes and solutions:
1. Your program is not suitable for running multiple instances. The
program has a fix-up record that references the data segment or DGROUP.
In a multiple instance application, this causes problems because every
instance of the application references that same data segment.
Typically, there are no fix-ups from the data segment because DS will
contain the data segment value.
Remember that there is no guarantee that you will be able to create
multiple instance large model applications by using the /Gx compiler
switch, especially if you have global C++ class objects. See the
documentation for this compiler switch for more information.
2. This warning has been reported to be caused by a reference to '__fac'
made by the C/C++ version 7.0 compiler. The code does not make a
reference to DS to access static data but to a constant value that is
fixed-up when the code is loaded. No such reports have connected the
same problem with Visual C++.
If DS can be loaded with a different value when a second instance
of an application is run, the code can be reused without crashing.
In the version of the code which uses the constant value for
referencing data, the second instance of an application might
write over the first instance's data.
The reported solution to this problem is to turn off the fast compile
option. (Use the /f- switch to specify the full optimizing compiler
instead.) This should stop the compiler from referencing the
constant.
3. The /GD compile switch optimizes prolog and epilog code for functions in
DLL files and is inappropriate for use when compiling modules for
applications (EXE files). Removing the /GD compiler switch should
correct the problem.
4. This warning can be reproduced by creating a function that uses the
__loadds keyword or some inline assembly code that loads the segment of
DGROUP into a register.
5. If you have a DATA MULTIPLE statement in your .DEF file, change it to
DATA SINGLE. This will allow only one copy of the data segment to
exist. NOTE: Putting the code into a DLL would have the same effect.
Additional reference words: 1.00 1.50 3.10 7.00 errmsg err msg
KBCategory: kbtool kbprb kberrmsg
KBSubcategory: TlsMisc
Keywords : kb16bitonly
Last Reviewed: July 23, 1997