PRB: L2061, L1106 Errors, Foundation Classes, Small Model App

ID: Q102678

7.00 | 1.00 1.50 MS-DOS | WINDOWS kbprg kbprb

The information in this article applies to:

SYMPTOMS

An attempt to build an application in the small memory model with the Microsoft Foundation Class Library versions 1.0 or 2.0 may fail and Microsoft LINK may generate the following messages:

   LINK : error L2061: no space for data block associated with
          <function> inside _TEXT segment

   LINK : error L1106: unknown COMDAT allocation type for
          <symbol> record ignored

CAUSE

These errors occur when insufficient memory is available to allocate vtables (virtual function tables) and message maps in the application's code segment (_TEXT). If the code segment grows too large, the allocations fail. In some cases, these errors occur only when you build a debugging version of the application, because the debugging versions of the Microsoft Foundation Classes libraries include additional debugging code. The increased size of the code segment causes the data block allocations to fail.

RESOLUTION

These errors do not indicate a bug (incorrect code) in either the application code or in the libraries. They simply reflect a limitation of the small memory model, that the size of the code segment must not exceed 64K. To resolve this situation, build the application in the medium memory model.

Even though you can build the debugging versions of the Microsoft Foundation Classes libraries in the small and compact memory models, we do not recommend that you use them. For additional information, please refer to the README.TXT file in the Microsoft Foundation Classes libraries source code directory (by default, C:\MSVC\MFC\SRC).

MORE INFORMATION

In the LINK errors above, the <function> and <symbol> fields show the decorated names for C++ functions in either the application or in the library. LINK generates a pair of messages for each symbol (one L2061 error and one L1106 error). LINK generates each of the L2061 messages before it generates any L1106 messages. The L1106 errors are caused by the L2061 errors.

The following is an extract from the README.TXT file in the Microsoft Foundation Classes libraries version 2.0 source code directory:

   NOTE: The Small and Compact models do not support DEBUG=1, they are
   for retail build variants only.

Additional reference words: 1.00 1.50 2.00 2.50 7.00 KBCategory: kbprg kbprb KBSubcategory: MfcMisc Keywords : kb16bitonly

Last Reviewed: July 18, 1997