Name Mangling
Name mangling is a technique used by compilers to give programming entities (functions, structures, classes, etc.) unique names. Traditionally, the name given to a programming entity in the source file (i.e. function "foo") would be the name of the symbol in the object code. With modern programming languagues this simple approach cannot be used.
For example, operator overloading allows a developer to define a single function "foo" with multiple interfaces such as
While these two declarations have the same name, they are not the entity, and therefore should not be given the same symbolic name. The compiler must give each entity a unique name.
The name that a compiler chooses to give to a programming entity in order to preserve its symbolic uniqueness is called a mangled name or decorated name.
I use Microsoft's Visual Studio 6.0 compiler more often than any other. http://msdn2.microsoft.com/en-US/library/deaxefa7.aspx
Visual Studio 6.0 uses the following characteristics to create a mangled name for a programming entity:
Use Depends.exe to view mangled symbols.
Use Undname.exe to translate mangled symbols back into their human readable form.
@@Uxx - "U" indicates that the entity is declared virtual
@@Qxx - "Q" indicates that the entity is not virtual
"There is currently no standard for C++ naming between compiler vendors or even between different versions of a compiler."
References:
For example, operator overloading allows a developer to define a single function "foo" with multiple interfaces such as
void foo (int i);
void foo (char i);
While these two declarations have the same name, they are not the entity, and therefore should not be given the same symbolic name. The compiler must give each entity a unique name.
The name that a compiler chooses to give to a programming entity in order to preserve its symbolic uniqueness is called a mangled name or decorated name.
I use Microsoft's Visual Studio 6.0 compiler more often than any other. http://msdn2.microsoft.com/en-US/library/deaxefa7.aspx
Visual Studio 6.0 uses the following characteristics to create a mangled name for a programming entity:
Use Depends.exe to view mangled symbols.
Use Undname.exe to translate mangled symbols back into their human readable form.
@@Uxx - "U" indicates that the entity is declared virtual
@@Qxx - "Q" indicates that the entity is not virtual
"There is currently no standard for C++ naming between compiler vendors or even between different versions of a compiler."
References:
- Wikipedia Entry on Name Mangling (http://en.wikipedia.org/wiki/Name_decoration)
- MSDN Entries (http://msdn2.microsoft.com/en-US/library/deaxefa7.aspx)
0 Comments:
Post a Comment
<< Home