PRB: Can't Export Symbols Differing Only by Leading Underscores (172393)
The information in this article applies to:
- The Linker (LINK.EXE), when used with:
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.0a
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Editions 4.2b
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ .NET (2003)
This article was previously published under Q172393 SYMPTOMS When you are using the linker supplied with the Visual C++
compiler versions mentioned above to build a DLL and the following applies:
- You export multiple symbols from a DLL.
- The symbols differ only by the number of leading
underscores or by the number of leading question marks.
- The first letter in the symbol is uppercase.
- The symbols are located in an assembly source file.
Then, the Visual C++ linker incorrectly matches some of the
symbol names. RESOLUTION There are several workarounds:
- Do not use leading underscores or leading question marks to
differentiate between different symbols. -or-
- Use Visual C or Visual C++ instead of assembly. -or-
- Use aliases in the EXPORTS section of the .def file as
shown below. The left-hand side of the "=" symbol is the name of the function
that is exported by the DLL and an external application/DLL can call. The
right- hand side is the symbol the linker will use to match during the link
phase. Note the missing underscore on the right hand side symbol.
EXPORTS Use the following link command to build the DLL:
link -dll -out:MYDLL.LIB -def:MYDLL.DEF MYDLL.OBJ
STATUS This behavior is by design.
Modification Type: | Major | Last Reviewed: | 9/23/2003 |
---|
Keywords: | kbprb KB172393 |
---|
|