MSVC 6.0 C++ name mangling conventions

Microsoft likes to call these decorated names, to each their own.  Here is what I’ve gleaned so far, use at your own risk.  In particular, this has changed before (going to MSVC 4), and could quite possibly change in the future.

stdcall:
?funcName @@YG retType params-list Z

cdecl:
?funcName @@YA retType params-list Z

thiscall:
?methodName @ className @@AAE retType param-list Z

static method call:
?methodName @ className @@CA retType param-list Z

If there are parameters, param-list is a list of them, followed by a @. Otherwise, param-list is X (void), with no @ afterwards.

Basic types:

  • D is char                int8
  • E is unsigned char      uint8
  • F is short               int16
  • G is unsigned short     uint16
  • H is int                 int32
  • I is unsigned int       uint32
  • J is long                int32
  • K is unsigned long      uint32
  • M is float              float32
  • N is double             float64
  • X is void
  • _J is int 64             int64
  • _K is unsigned int 64   uint64
  • _N is bool

Pointers:

  • PA prefixes a type to indicate a pointer
  • PB prefixes a type to indicate a const pointer

Note: volatile is not represented in the mangled/decorated name

Structures:
UstructName@@ is structName
a pointer to a struct occurs as PA or PB followed by a U...

Udigit@
Constructing reference to the previous digit-th U definition (1 based).
In other words, it creates a new definition that can be referenced later on as well.

digit
Reference to the previous digit-th U definition (0 based!!!)

For structures, a PAUname@@ will be referenced as 0 in other parameters of the form name *, but the first parameter of the form name will appear as U1@ and subsequently as 1.

The converse is having a Uname@@ first, and then parameters of the form name * will appear first as PAU1@ and subsequently as 1, and parameters of the form name as 0.

Note: 0 and 1 in these two examples are the positions of the first Ux@@ and first Uy@ declarations, they could be 2 and 4 if there were two decls before the first, and one decl in between.