The information in this article applies to:
SUMMARYThe Microsoft C++ compilers encode the names of symbols in C++ programs to include type information in the name. This is called "name decoration," or "name mangling." The purpose of this is to ensure type-safe linking. The C++ language allows function overloading where functions with the same name are only distinguished from one another by the data types of the arguments to the functions. Name decoration enables the linker to distinguish between different versions of overloaded functions because the names of the functions are encoded or decorated differently. MORE INFORMATION
Different compiler vendors have their own methods or algorithms for
decorating names. Microsoft does not publish the algorithm its compilers
use for name decoration because it may change in the future. However, it
is sometimes necessary to get the decorated version of a function name.
For example, you may need to export a C++ function from a Windows DLL by
listing it in the EXPORTS section of a .DEF file used to build the DLL.
(Although declaring the function with __declspec( dllexport ) is the
preferred method to export a C++ function using Visual C++, 32-bit Edition,
it is still valid to use a .DEF file with these products.) To export the
function successfully, you need to list its decorated name, not the name in
the source code.
Q132044 How to Use _declspec(dllimport) & _declspec(dllexport) and WhyThe following sample code uses the FormatDName function in the browser library, part of the browser toolkei. The function returns the undecorated form of the name passed to it. Sample Code
The following example works with the newer browser toolkit 5.0 and Visual
C++ version 5.0.
Keywords : kbcode kbCompiler kbCPPonly kbVC kbVC150 kbVC151 kbVC152 kbVC200 kbVC210 kbVC400 kbVC410 kbVC500 kbVC600 |
Last Reviewed: September 16, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |