Problem: Building a VC++ DLL returns error LNK1189 when there are too many exports

Problem: Building a VC++ DLL returns error LNK1189 when there are too many exports

Article ID : 949945
Last Review : March 4, 2008
Revision : 1.1
Source: Microsoft Support

Back to the top

RAPID PUBLISHING

RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

Back to the top

Action

Create a C++ DLL project. Try to export more than 64K (65,536) functions, classes and members of classes from it. Now build this project.

Back to the top

Result

While building the C++ DLL project, it throws LNK1189 error.
The exact error message is …..The limit of 65535 objects or members in a library has been exceeded.

 

Back to the top

Cause

In the MSDN Library, this error message has the following description:
LIBTOOMANYMEMBERS:: library limit of number objects exceeded
The limit of 65535 objects or members in a library has been exceeded.

64k is the maximum limitation for the library for export symbols. There is no way to go beyond this limit.
It’s a expected behavior and built into the format of a library; a limitation from the compiler for DLLs.

Back to the top

Resolution

The only possible resolution is to have a lesser number (less than 64K) of exports from the library.
Consider dividing the DLL into two (or more) to limit the number of exports in each to less than 64K. 

Back to the top

More Information

Linker Tools Error LNK1189 (http://msdn2.microsoft.com/en-us/library/at5879hx.aspx)

Back to the top

DISCLAIMER

MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.

Back to the top


APPLIES TO
• Microsoft Visual Studio .NET (2003), Academic Edition
• Microsoft Visual Studio .NET 2003 Professional Edition
• Microsoft Visual Studio .NET 2003 Enterprise Architect
• Microsoft Visual Studio .NET 2003 Enterprise Developer
• Microsoft Visual Studio 2005 Standard Edition
• Microsoft Visual Studio 2005 Professional Edition
• Microsoft Visual Studio 2005 Team Suite
• Microsoft Visual Studio 2008 Academic Edition
• Microsoft Visual Studio 2008 Standard Edition
• Microsoft Visual Studio 2008 Professional Edition

Back to the top

Keywords: 
kbnomt kbrapidpub KB949945

Back to the top

 

Microsoft Knowledge Base Article.This article contents is Microsoft Copyrighted material.
2005-2007 Microsoft Corporation. All rights reserved.


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image