L4001 Warning May Be Caused by Using Wrong Linker

ID Number: Q74169

5.01.21 5.03 5.05 5.10 5.11 5.13 5.15

OS/2

Summary:

In certain cases, the Microsoft LINK Utility (LINK.EXE) may generate

an L4001 warning to indicate that an address from one frame of

reference to another is to be fixed up. In most cases, the initial

frame is ignored and a far address calculation is used instead.

However, it is possible that this warning may be incorrectly generated

if the wrong linker is used. For instance, if a C module is compiled

with the 386 version of the C compiler and one of the version 5.x

Segmented Executable Linkers is used to create the .EXE, the linker

will generate a message similar to the following:

warning L4001: frame-relative fix-up,

frame ignored near xxx in segment yyy

The same situation may occur if the Microsoft Macro Assembler (MASM)

version 6.0 is used to write code for the FLAT model. In both cases,

the solution is to use the Linear Executable Linker (LINK386.EXE).

The sample code below shows both the problem and the solution. Compile

with CL386 and link with both linkers to see the different results.

Sample Code

-----------

/* Compile options needed: Compile with CL386

Link options needed: Link with LINK 5.x to see errors

Link with LINK386 1.x for correct results

*/

#include <stdio.h>

void main(void)

{

printf("This is a test\n");

}

Additional reference words: LINK386 1.00.018 5.1