Microsoft KB Archive/45710

{|
 * width="100%"|

L2002 or L4004 Mixing Memory Models Between Modules

 * }

Q45710

6.00 6.00a 6.00ax 7.00 | 6.00 6.00a | 1.00 1.50 MS-DOS | OS/2 | WINDOWS kbtool -- The information in this article applies to: - Microsoft C for MS-DOS, versions 6.0, 6.0a, and 6.0ax - Microsoft C for OS/2, versions 6.0, and 6.0a - Microsoft C/C++ for MS-DOS, versions 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 -- SUMMARY ======= 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 warning: L4004: possible fixup overflow at in segment or the following error: L2002: fixup overflow at in segment 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 &quot;near&quot; and &quot;far&quot; 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 void main(void); void main { printf(&quot; module 1 \n&quot;); mod2; } is linked with the module, MOD2.C #include void mod2(void); void mod2 { printf(&quot; module 2 \n&quot;); } 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: kbinf 6.00 6.00a 6.00ax 7.00 1.00 1.50 KBCategory: kbtool KBSubcategory: LinkIss

Keywords : kb16bitonly

Issue type :

Technology : kbVCsearch kbAudDeveloper kbPTProdChange kbvc150 kbvc100 kbCCompSearch kbZNotKeyword3 kbCComp600DOS kbCComp600aDOS kbCComp600axDOS kbCComp600OS2 kbCComp600aOS2 kbCVC700DOS