The Secret Life of C++: Symbol Mangling

Back to Day 1
Symbol mangling is done by C++ because the linker only supports a global namespace. Basically, mangling is a lot like what C programmer do by hand when they name their functions things like libfoo_getobjattr(). Except that the C++ mangling is done automatically, and so it has to really be unique.

Mangled names always start with _Z. Following this is the mangled name of either a function and its type, an object name, or a "special name".

There are a number of attributes that will be included in the mangled name of a function:


Richard Tibbetts
Last modified: Tue Jan 20 23:53:13 EST 2004