Learn C++ Itanium Symbol Mangling

Lesson 0: Intro and C names

Welcome to the interactive Itanium C++ mangling learning website! In this course you will learn everything there is to know about Itanium C++ Mangling, especially the things you've never wanted to know.

For every exercise, there will be a small quiz. If you complete the quiz, you can continue

To complete the first quiz, press the button below.

Congrats, you just completed your first challenge! Good job. So, let's start with the mangling. Before diving too deep into the innards of Itanium Mangling, let's get more familiar with the way this works by mangling something trivial: a C function. C functions are traditionally not mangled (*this is not always fully true on all platforms). The simplest possible C function takes no arguments and returns no value. For C it doesn't actually matter what the parameters or return value are, since there is no mangling.

To reference this function in C++, we use an extern "C" block.

extern "C" {
  void hello() {}
}
          

Because no mangling is applied to the identifier at all, the symbol for this function will simply be hello.

Similarly, a more complex example would be the following function:

extern "C" {
  int main(int argc, char* argv[]) {}
}
          

But once again, the symbol name will simply be main because no mangling is applied.

What is the mangled symbol of the following function?

extern "C" {
  long long meow(long long argument, long long second) { /* too long */ }
}
            

Congrats on answering your first mangling question!

You now know how C functions are (not) mangled, which is a great starting point for your C++ Itanium Symbol Mangling Adventures. I wish you good luck for the rest!