FIX: More Than 65536 Export Entries May Cause LNK2001 Errors (128599)
The information in this article applies to:
- The Linker (LINK.EXE), when used with:
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
This article was previously published under Q128599 SYMPTOMS
When linking to an import library, you may get unresolved external errors
(LNK2001) on objects that are exported using the __declspec(dllexport)
attribute. This problem is most common when exporting a large number of
classes from a DLL.
CAUSE
The compiler generates export directives for each definition of an exported
object in a source file. The linker combines these into a list when
generating the executable that is translated into an import library.
The linker fails to distinguish between distinct and non-distinct (or
duplicate) export directives. Because Win32 is limited to 64 KB of ordinals
per DLL, the linker uses a two-byte unsigned integer to count the exports.
The unsigned integer counter wraps around after counting 65536 exports.
This results in smaller than expected import libraries.
This is only a problem in large DLLs that export a lot of information.
RESOLUTION
Here are three possible workarounds for this problem: STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This problem was fixed in Microsoft
Visual C++, 32-bit Edition, version 4.0.
Modification Type: | Major | Last Reviewed: | 10/24/2003 |
---|
Keywords: | kbbug kbcode kbfix KB128599 |
---|
|