INF: L2002 if Linking Small Model Main w/ Other Memory Models

ID Number: Q45710

5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

In Microsoft C versions 5.0, 5.1, 6.0, 6.0a, 6.0ax, and C/C++ version

7.0, an attempt to link a module that has been compiled in the small

memory model with a module compiled in the medium or large memory model

produces the following error:

L2002: fixup overflow

The cause, in this particular case, of the "fixup overflow" error

message is not documented in the C version 5.1 "CodeView and

Utilities, Microsoft Editor, Mixed-Language Programming Guide" on page

366.

Normally, you should NOT link programs that contain different memory

models. All modules should be compiled using the same memory model.

(You can use the "near" and "far" keywords to produce mixed-model

programs, but this is tricky and usually doesn't give much performance

gain.)

More Information:

If the following module, MOD1.C

#include<stdio.h>

void main(void);

void main()

{

printf(" module 1 \n");

mod2();

}

is linked with the module, MOD2.C

#include<stdio.h>

void mod2(void);

void mod2()

{

printf(" module 2 \n");

}

in various memory models, the following results occur:

Memory Model Result

------------ ------

MOD1 | MOD2

------|-----

|

/AS | /AM L2002 : fixup overflow

|

/AS | /AL L2002 : fixup overflow

|

/AM | /AS Links, hangs on run

|

/AM | /AL Executes normally

|

/AL | /AS Links, hangs on run

|

/AL | /AM Links, prints trash for MOD2 on run

Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax 7.00