Visual C++ Developer Center > Visual C++ Forums > Visual C++ General > KB949945: Problem: Building a VC++ DLL returns error LNK1189 when there are too many exports
Ask a questionAsk a question
 

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

  • Thursday, August 28, 2008 4:23 AMXiaoyun Li – MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    KNOWLEDGE BASE SOLUTIONS

    KNOWLEDGE BASE SOLUTIONS 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.

     

    Link to Original Article from Microsoft Support

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

    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.

    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."

Answers

  • Thursday, August 28, 2008 4:24 AMXiaoyun Li – MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    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.

    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. 

    More Information

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

    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.

All Replies

  • Thursday, August 28, 2008 4:24 AMXiaoyun Li – MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    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.

    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. 

    More Information

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

    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.