| 136:ecec2045ca67 |
added missing loader animation
1 ## vim: syn=mako 2 <%! title = u'Microsoft C++ Name Mangling Scheme' %> 3 4 *version 1.2 (July 20, 2006)* 5 6 This document discusses C++ name mangling scheme used by Microsoft. I think this is the most complete document about this scheme currently. 7 8 9 <h3 id="top-author">Author</h3> 10 This document is maintained by [Kang Seonghoon](http://tokigun.net/) aka Tokigun. 11 12 If you want to discuss about this scheme or document please mail me: `<xxxxxxx at gmail dot com>` where xxxxxxx is tokigun. 13 14 And sorry for my poor English ;) 15 16 17 <h3 id="top-reference">Reference</h3> 18 19 Even though I could disassemble dbghelp.dll(or msvcrt.dll), I didn't do it because of the legal issues. So I used only `UnDecorateSymbolName` function to analysis this scheme. 20 21 Also I learned the basic scheme from the following source: 22 23 * [wine](http://winehq.org/)'s `__unDname` function implementation (see [/wine/dlls/msvcrt/undname.c](http://cvs.winehq.com/cvsweb/wine/dlls/msvcrt/undname.c)) 24 * [http://www.kegel.com/mangle.html](http://www.kegel.com/mangle.html) 25 * [PHP UnDecorateSymbolName](http://sourceforge.net/projects/php-ms-demangle/) by Timo Stripf 26 27 Some feature of this scheme depends on Microsoft's C++ extension, such as Managed C++. Browse [MSDN](http://msdn.microsoft.com/) for more information. 28 29 30 <h3 id="top-changelog">ChangeLog</h3> 31 32 * <strong>version 1.2</strong> - Added [nested name](#element-name-nested); added PHP UnDecorateSymbolName as reference. 33 * [version 1.1](mscmangle-1.1) - First public document. 34 35 36 <h2 id="basic">Basic Structure</h2> 37 As you know, all mangled C++ name starts with <`?`>. Because all mangled C name starts with alphanumeric characters, <`@`>(at-sign) and <`_`>(underscore), C++ name can be distinguished from C name. 38 39 Structure of mangled name looks like this: 40 41 * Prefix <`?`> 42 * *Optional:* Prefix <`@?`> <small>[TODO: what does <`CV:`> mean?]</small> 43 * [Qualified name](#element-name) 44 * Type information (see below) 45 46 47 <h3 id="basic-function">Function</h3> 48 Type information in function name generally looks like this: 49 50 * Access level and function type 51 * *Conditional:* [CV-class modifier](#element-cvclass) of function, if non-static member function 52 * [Function property](#element-function) 53 54 55 <h3 id="basic-data">Data</h3> 56 Type information in data name looks like this: 57 58 * Access level and storage class 59 * [Data type](#element-type) 60 * [CV-class modifier](#element-cvclass) 61 62 63 <h2 id="element">Elements</h2> 64 Mangled name contains a lot of elements have to be discussed. 65 66 67 <h3 id="element-name">Name</h3> 68 Qualified name consists of the following fragments: 69 70 * Basic name: one of [name fragment](#element-name-frag) and [special name](#element-name-special) 71 * Qualification #1: one of [name fragment](#element-name-frag), [name with template arguments](#element-name-template), [numbered namespace](#element-name-nsnum) and [back reference](#element-name-backref) 72 * Qualification #2 73 * ... 74 * Terminator <`@`> 75 76 Qualification is written in reversed order. For example `myclass::nested::something` becomes <`something@nested@myclass@@`>. 77 78 79 <h4 id="element-name-frag">Name Fragment</h4> 80 A fragment of name is simply represented as the name with trailing <`@`>. 81 82 83 <h4 id="element-name-special">Special Name</h4> 84 Special name is represented as the code with preceding <`?`>. Most of special name is constructor, destructor, operator and internal symbol. Below is a table for known codes. 85 86 <table> 87 <thead> 88 <tr><th>Code</th><th>Meaning with no <`_`></th><th>Meaning with preceding <`_`></th><th>Meaning with preceding two <`_`>s</th></tr> 89 </thead> 90 <tbody> 91 <tr><th><`0`></th><td>Constructor</td><td>`operator/=`</td></tr> 92 <tr><th><`1`></th><td>Destructor</td><td>`operator%=`</td></tr> 93 <tr><th><`2`></th><td>`operator new`</td><td>`operator>>=`</td></tr> 94 <tr><th><`3`></th><td>`operator delete`</td><td>`operator<<=`</td></tr> 95 <tr><th><`4`></th><td>`operator=`</td><td>`operator&=`</td></tr> 96 <tr><th><`5`></th><td>`operator>>`</td><td>`operator|=`</td></tr> 97 <tr><th><`6`></th><td>`operator<<`</td><td>`operator^=`</td></tr> 98 <tr><th><`7`></th><td>`operator!`</td><td>\`vftable'</td></tr> 99 <tr><th><`8`></th><td>`operator==`</td><td>\`vbtable'</td></tr> 100 <tr><th><`9`></th><td>`operator!=`</td><td>\`vcall'</td></tr> 101 <tr><th><`A`></th><td>`operator[]`</td><td>\`typeof'</td><td>\`managed vector constructor iterator'</td></tr> 102 <tr><th><`B`></th><td>`operator *returntype*`[^1]</td><td>\`local static guard'</td><td>\`managed vector destructor iterator'</td></tr> 103 <tr><th><`C`></th><td>`operator->`</td><td>\`string' *(Unknown)*[^2]</td><td>\`eh vector copy constructor iterator'</td></tr> 104 <tr><th><`D`></th><td>`operator*`</td><td>\`vbase destructor'</td><td>\`eh vector vbase copy constructor iterator'</td></tr> 105 <tr><th><`E`></th><td>`operator++`</td><td>\`vector deleting destructor'</td></tr> 106 <tr><th><`F`></th><td>`operator--`</td><td>\`default constructor closure'</td></tr> 107 <tr><th><`G`></th><td>`operator-`</td><td>\`scalar deleting destructor'</td></tr> 108 <tr><th><`H`></th><td>`operator+`</td><td>\`vector constructor iterator'</td></tr> 109 <tr><th><`I`></th><td>`operator&`</td><td>\`vector destructor iterator'</td></tr> 110 <tr><th><`J`></th><td>`operator->*`</td><td>\`vector vbase constructor iterator'</td></tr> 111 <tr><th><`K`></th><td>`operator/`</td><td>\`virtual displacement map'</td></tr> 112 <tr><th><`L`></th><td>`operator%`</td><td>\`eh vector constructor iterator'</td></tr> 113 <tr><th><`M`></th><td>`operator<`</td><td>\`eh vector destructor iterator'</td></tr> 114 <tr><th><`N`></th><td>`operator<=`</td><td>\`eh vector vbase constructor iterator'</td></tr> 115 <tr><th><`O`></th><td>`operator>`</td><td>\`copy constructor closure'</td></tr> 116 <tr><th><`P`></th><td>`operator>=`</td><td>\`udt returning' *(prefix)*</td></tr> 117 <tr><th><`Q`></th><td>`operator,`</td><td>*Unknown*[^3]</td></tr> 118 <tr><th><`R`></th><td>`operator()`</td><td>*RTTI-related code (see below)*</td></tr> 119 <tr><th><`S`></th><td>`operator~`</td><td>\`local vftable'</td></tr> 120 <tr><th><`T`></th><td>`operator^`</td><td>\`local vftable constructor closure'</td></tr> 121 <tr><th><`U`></th><td>`operator|`</td><td>`operator new[]`</td></tr> 122 <tr><th><`V`></th><td>`operator&&`</td><td>`operator delete[]`</td></tr> 123 <tr><th><`W`></th><td>`operator||`</td></tr> 124 <tr><th><`X`></th><td>`operator*=`</td><td>\`placement delete closure'</td></tr> 125 <tr><th><`Y`></th><td>`operator+=`</td><td>\`placement delete[] closure'</td></tr> 126 <tr><th><`Z`></th><td>`operator-=`</td><td></td><td></td></tr> 127 </tbody> 128 </table> 129 130 [^1]: Its meaning depends on return type of function. For instance, if this function returns <`int`> type then its name will be `operator int`. 131 132 [^2]: It seems structure after <`?_C`> is different from other structure. I think this structure is represented as regular expression <`\?_C@_[0-9A-P]([0-9A-P][A-P]*)?@.*@`>, but I'm not sure. 133 134 [^3]: It can be EH-related code, but `UnDecorateSymbolName` function cannot demangle this. 135 136 Prefix <`_P`> is used as <`?_PX`>, though I don't know about it. <small>[TODO: what is udt? user defined type?]</small> 137 138 Below is RTTI-related code (all starting with <`_R`>). Some codes have trailing parameters. 139 140 <table> 141 <thead> 142 <tr><th>Code</th><th>Meaning</th><th>Trailing Parameters</th></tr> 143 </thead> 144 <tbody> 145 <tr><th><`_R0`></th><td>*type* \`RTTI Type Descriptor'</td><td>[Data type](#element-type) *type*.</td></tr> 146 <tr><th><`_R1`></th><td>\`RTTI Base Class Descriptor at (*a*,*b*,*c*,*d*)'</td><td>Four [encoded numbers](#element-number) *a*, *b*, *c* and *d*.</td></tr> 147 <tr><th><`_R2`></th><td>\`RTTI Base Class Array'</td><td>None.</td></tr> 148 <tr><th><`_R3`></th><td>\`RTTI Class Hierarchy Descriptor'</td><td>None.</td></tr> 149 <tr><th><`_R4`></th><td>\`RTTI Complete Object Locator'</td><td>None.</td></tr> 150 </tbody> 151 </table> 152 153 <h4 id="element-name-template">Name with Template Arguments</h4> 154 Name fragment starting with <`?$`> has template arguments. This kind of name looks like this: 155 156 * Prefix <`?$`> 157 * Name terminated by <`@`> 158 * [Template argument list](#element-arglist-template) 159 160 For example, we assume the following prototype. 161 162 void __cdecl abc<def<int>,void*>::xyz(void); 163 164 Name of this function can be obtained by the following process: 165 166 abc<def<int>,void*>::xyz 167 ---------------------------------------- 168 xyz@ *abc<def<int>,void*>* @ 169 xyz@ ?$abc@ *def<int>* *void** @ @ 170 xyz@ ?$abc@ V *def<int>* @ PAX @ @ 171 xyz@ ?$abc@ V ?$def@H@ @ PAX @ @ 172 ---------------------------------------- 173 xyz@?$abc@V?$def@H@@PAX@@ 174 175 So mangled name for this function is <code>?**xyz@?$abc@V?$def@H@@PAX@@**YAXXZ</code>. 176 177 178 <h4 id="element-name-nested">Nested Name</h4> 179 Name fragment starting with <`??`> denotes nested name. Nested name is a name inside local scope but needed to be exported. Its structure looks like the following: 180 181 * Prefix <`?`> 182 * C++ Mangled name (so starting with <`?`> again) 183 184 For example, <`?nested@??func@@YAXXZ@4HA`> means variable <`?nested@@4HA`>(`int nested`) inside <`?func@@YAXXZ`>(`void __cdecl func(void)`). `UnDecorateSymbolName` function returns ``int `void __cdecl func(void)'::nested`` for this input. 185 186 187 <h4 id="element-name-nsnum">Numbered Namespace</h4> 188 In qualification, numbered namespace is represented as preceding <`?`> and unsigned [number](#element-number). `UnDecorateSymbolName` function returns something like `` `42'`` for this kind of input. 189 190 Exceptionally if numbered namespace starts with <`?A`> it becomes anonymous namespace (`` `anonymous namespace'``). 191 192 Well, of course I'm not sure what it is. <small>[TODO: what is exact meaning and name? I don't think its name is really "numbered namespace".]</small> 193 194 195 <h4 id="element-name-backref">Back Reference</h4> 196 Decimal digits <`0`> to <`9`> refers to first shown name fragment to 10th shown name fragment. Referred name fragment can be normal name fragment or name fragment with template arguments. For example, in <`alpha@?1beta@@`>(``beta::`2'::alpha``) <`0`> refers to <`alpha@`>, and <`1`>(not <`2`>) refers to <`beta@`>. 197 198 Generally back reference table is kept during mangling process. It means you can use back reference to function name in function arguments (shown later than function name). However, in [template argument list](#element-arglist-template) back reference table is separately created. 199 200 For example, assume <code>?\$basic_string@GU?\$char_traits@G@std@@V?\$allocator@G@**2**@@std@@</code>​(`std::basic_string<unsigned short, std::char_traits<unsigned short>, **std**::allocator<unsigned short> >`). In <`std::basic_string<...>`>, <`0`> refers to <`basic_string@`>, <`1`> refers to <`?$char_traits@G@`>, and <`2`> refers to <`std@`>. This relation doesn't change wherever it is. 201 202 203 <h3 id="element-number">Encoded Number</h3> 204 In name mangling, representation of number is needed sometimes (e.g. array indices). There are simple rules to represent number: 205 206 * <`0`> to <`9`> represents number 1 to 10. 207 * <`*num*@`> represents hexadecimal number, where *num* consists of hexadecimal digit <`A`>(means 0) to <`P`>(means 15). For example <`BCD@`> means number 0x123, that is 291. 208 * <`@`> represents number 0. 209 * If allowed, prefix <`?`> represents minus sign. Note that both <`?@`> and <`@`> represents number 0. 210 211 212 <h3 id="element-type">Data Type</h3> 213 The table below shows various data type and modifiers. 214 215 <table> 216 <thead> 217 <tr><th>Code</th><th>Meaning with no <`_`></th><th>Meaning with preceding <`_`></th></tr> 218 </thead> 219 <tbody> 220 <tr><th><`?`></th><td>*Type modifier, Template parameter*</td></tr> 221 <tr><th><`$`></th><td>*Type modifier, Template parameter*[^4]</td><td>__w64 *(prefix)*</td></tr> 222 <tr><th><`0`>-<`9`></th><td>*Back reference*</td></tr> 223 <tr><th><`A`></th><td>*Type modifier (reference)*</td></tr> 224 <tr><th><`B`></th><td>*Type modifier (volatile reference)*</td></tr> 225 <tr><th><`C`></th><td>signed char</td></tr> 226 <tr><th><`D`></th><td>char</td><td>__int8</td></tr> 227 <tr><th><`E`></th><td>unsigned char</td><td>unsigned __int8</td></tr> 228 <tr><th><`F`></th><td>short</td><td>__int16</td></tr> 229 <tr><th><`G`></th><td>unsigned short</td><td>unsigned __int16</td></tr> 230 <tr><th><`H`></th><td>int</td><td>__int32</td></tr> 231 <tr><th><`I`></th><td>unsigned int</td><td>unsigned __int32</td></tr> 232 <tr><th><`J`></th><td>long</td><td>__int64</td></tr> 233 <tr><th><`K`></th><td>unsigned long</td><td>unsigned __int64</td></tr> 234 <tr><th><`L`></th><td></td><td>__int128</td></tr> 235 <tr><th><`M`></th><td>float</td><td>unsigned __int128</td></tr> 236 <tr><th><`N`></th><td>double</td><td>bool</td></tr> 237 <tr><th><`O`></th><td>long double</td><td>*Array*</td></tr> 238 <tr><th><`P`></th><td>*Type modifier (pointer)*</td></tr> 239 <tr><th><`Q`></th><td>*Type modifier (const pointer)*</td></tr> 240 <tr><th><`R`></th><td>*Type modifier (volatile pointer)*</td></tr> 241 <tr><th><`S`></th><td>*Type modifier (const volatile pointer)*</td></tr> 242 <tr><th><`T`></th><td>*Complex Type (union)*</td></tr> 243 <tr><th><`U`></th><td>*Complex Type (struct)*</td></tr> 244 <tr><th><`V`></th><td>*Complex Type (class)*</td></tr> 245 <tr><th><`W`></th><td>*Enumerate Type (enum)*</td><td>wchar_t</td></tr> 246 <tr><th><`X`></th><td>void, *Complex Type (coclass)*</td><td>*Complex Type (coclass)*</td></tr> 247 <tr><th><`Y`></th><td>*Complex Type (cointerface)*</td><td>*Complex Type (cointerface)*</td></tr> 248 <tr><th><`Z`></th><td>... *(elipsis)*</td><td></td></tr> 249 </tbody> 250 </table> 251 252 [^4]: There is <`$$B`> prefix, but it seems that this prefix can be ignored. 253 254 Actually void for <`X`> and elipsis for <`Z`> can be used only for terminator of [argument list](#element-arglist) or pointer. Otherwise, <`X`> is used as cointerface. 255 256 257 <h4 id="element-type-primitive">Primitive & Extended Type</h4> 258 Primitive types are represented as one character, and extended types are represented as one character preceding <`_`>. 259 260 261 <h4 id="element-type-backref">Back Reference</h4> 262 Decimal digits <`0`> to <`9`> refers to first shown type to 10th shown type in argument list. (It means return type cannot be referred.) Back reference can refer to any non-primitive type, including extended type. Of course back reference can refer to prefixed type such as <`PAVblah@@`>(`class blah *`), but cannot refer to prefixless type — say, <`Vblah@@`> in <`PAVblah@@`>. 263 264 As back reference for name, in [template argument list](#element-arglist-template) back reference table is separately created. Function argument list has no such scoping rule, though it can be confused sometimes. For example, assume <`P6AXValpha@@Vbeta@@@Z`>(`void (__cdecl*)(class alpha, class beta)`) is first shown non-primitive type. Then <`0`> refer to <`Valpha@@`>, <`1`> refer to <`Vbeta@@`>, and finally <`2`> refer to function pointer. 265 266 267 <h4 id="element-type-typemod">Type Modifier</h4> 268 Type modifier is used to make pointer or reference. Type modifier looks like this: 269 270 * Modifier type 271 * *Optional:* Managed C++ property (<`$A`> for \__gc, <`$B`> for \__pin) 272 * [CV-class modifier](#element-cvclass) 273 * *Optional:* Array property (not for function) 274 * Prefix <`Y`> 275 * [Encoded unsigned number](#element-number) of dimension 276 * Array indices as encoded unsigned number, *dimension* times 277 278 * Referred type info (see below) 279 280 There is eight type of type modifier: 281 282 <table class="centered-cell"> 283 <thead> 284 <tr><th></th><th>*none*</th><th>const</th><th>volatile</th><th>const volatile</th></tr> 285 </thead> 286 <tbody> 287 <tr><th>Pointer</th><td><`P`></td><td><`Q`></td><td><`R`></td><td><`S`></td></tr> 288 <tr><th>Reference</th><td><`A`></td><td></td><td><`B`></td><td></td></tr> 289 <tr><th>*none*</th><td><`?`>[^5], <`$$C`></td><td></td><td></td><td></td></tr> 290 </tbody> 291 </table> 292 293 [^5]: <`?`> is valid only for type of [data](#data). Also <`?`> should be the outmost type modifier. (<`?CPB`> is valid but <`PB?C`> is not.) 294 295 For normal type, referred type info is [data type](#element-type). For function, it looks like the following. (It depends on CV-class modifier) 296 297 * *Conditional:* [CV-class modifier](#element-cvclass), if member function 298 * [Function property](#element-function) 299 300 301 <h4 id="element-type-aggregate">Complex Type (union, struct, class, coclass, cointerface)</h4> 302 Complex type looks like this: 303 304 * Kind of complex type (<`T`>, <`U`>, <`V`>, ...)[^6] 305 * [Qualification without basic name](#element-name) 306 307 [^6]: <`?`> and <`L`> can be complex type without any tag such as class, but it can also be a bug of the function. 308 309 310 <h4 id="elemene-type-enum">Enumerate Type (enum)</h4> 311 Enumerate type starts with prefix <`W`>. It looks like this: 312 313 * Prefix <`W`> 314 * Real type for enum 315 * [Qualification without basic name](#element-name) 316 317 Real type for enum is represented as the following: 318 319 <table> 320 <thead> 321 <tr><th>Code</th><th>Corresponding Real Type</th></tr> 322 </thead> 323 <tbody> 324 <tr><th><`0`></th><td>char</td></tr> 325 <tr><th><`1`></th><td>unsigned char</td></tr> 326 <tr><th><`2`></th><td>short</td></tr> 327 <tr><th><`3`></th><td>unsigned short</td></tr> 328 <tr><th><`4`></th><td>int *(generally normal "enum")*</td></tr> 329 <tr><th><`5`></th><td>unsigned int</td></tr> 330 <tr><th><`6`></th><td>long</td></tr> 331 <tr><th><`7`></th><td>unsigned long</td></tr> 332 </tbody> 333 </table> 334 335 <h4 id="elemene-type-array">Array</h4> 336 Array (not pointer to array!) starts with prefix <`_O`>. It looks like this: 337 338 * Prefix <`_O`> 339 * [CV-class modifier](#element-cvclass) 340 * [Data type](#element-type) within array 341 342 You can use multi-dimensional array like <`_OC_OBH`>, but only the outmost CV-class modifier is affected. (In this case <`_OC_OBH`> means `int volatile [][]`, not `int const [][]`) 343 344 345 <h4 id="elemene-type-template">Template Parameter</h4> 346 Template parameter is used to represent type and non-type template argument. It can be used in only [template argument list](#element-arglist-template). 347 348 The table below is a list of known template parameters. *a*, *b*, *c* represent [encoded signed numbers](#element-number), and *x*, *y*, *z* represent [encoded unsigned numbers](#element-number). 349 350 <table> 351 <thead> 352 <tr><th>Code</th><th>Meaning</th></tr> 353 </thead> 354 <tbody> 355 <tr><th><`?[x]`></th><td>anonymous type template parameter *x* (`` `template-parameter-[x]'``)</td></tr> 356 <tr><th><`$0[a]`></th><td>integer value *a*</td></tr> 357 <tr><th><`$2[a][b]`></th><td>real value *a* × 10^*b*-*k*+1^, where *k* is number of decimal digits of *a*[^7]</td></tr> 358 <tr><th><`$D[a]`></th><td>anonymous type template parameter *a* (`` `template-parameter[a]'``)</td></tr> 359 <tr><th><`$F[a][b]`></th><td>2-tuple {*a*,*b*} *(unknown)*</td></tr> 360 <tr><th><`$G[a][b][c]`></th><td>3-tuple {*a*,*b*,*c*} *(unknown)*</td></tr> 361 <tr><th><`$H[x]`></th><td>*(unknown)*</td></tr> 362 <tr><th><`$I[x][y]`></th><td>*(unknown)*</td></tr> 363 <tr><th><`$J[x][y][z]`></th><td>*(unknown)*</td></tr> 364 <tr><th><`$Q[a]`></th><td>anonymous non-type template parameter *a* (`` `non-type-template-parameter[a]'``)</td></tr> 365 </tbody> 366 </table> 367 368 [^7]: For example, <`$2HKLH@?2`> means 3.1415 × 10^-3^ = 0.0031415, because <`HKLH@`> means 31415 and <`?2`> means -3. 369 370 <h3 id="element-arglist">Argument List</h3> 371 Argument list is a sequence of [data types](#element-type). List can be one of the following: 372 373 * <`X`> (means `void`, also terminating list) 374 * *arg1* *arg2* ... *argN* <`@`> (means normal list of data types. Note that N can be zero) 375 * *arg1* *arg2* ... *argN* <`Z`> (means list with trailing elipsis) 376 377 378 <h4 id="element-arglist-template">Template Argument List</h4> 379 Template argument list is same to argument list, except [template parameters](#element-type-template) can be used. 380 381 382 <h3 id="element-cvclass">CV-class Modifier</h3> 383 The following table shows CV-class modifiers.[^0] 384 385 <table class="centered-cell"> 386 <thead> 387 <tr><th rowspan="2"></th><th colspan="4">Variable</th><th rowspan="2">Function</th></tr> 388 <tr><td>*none*</td><td>const</td><td>volatile</td><td>const volatile</td></tr> 389 </thead> 390 <tbody> 391 <tr><th>*none*</th><td><`A`></td><td><`B`>, <`J`></td><td><`C`>, <`G`>, <`K`></td><td><`D`>, <`H`>, <`L`></td><td><`6`>, <`7`></td></tr> 392 <tr><th>\__based()</th><td><`M`></td><td><`N`></td><td><`O`></td><td><`P`></td><td><`_A`>, <`_B`></td></tr> 393 <tr><th>Member</th><td><`Q`>, <`U`>, <`Y`></td><td><`R`>, <`V`>, <`Z`></td><td><`S`>, <`W`>, <`0`></td><td><`T`>, <`X`>, <`1`></td><td><`8`>, <`9`></td></tr> 394 <tr><th>\__based() Member</th><td><`2`></td><td><`3`></td><td><`4`></td><td><`5`></td><td><`_C`>, <`_D`></td></tr> 395 </tbody> 396 </table> 397 398 CV-class modifier can have zero or more prefix: 399 400 <table> 401 <thead> 402 <tr><th>Prefix</th><th>Meaning</th></tr> 403 </thead> 404 <tbody> 405 <tr><th><`E`></th><td>*type* __ptr64</td></tr> 406 <tr><th><`F`></th><td>__unaligned *type*</td></tr> 407 <tr><th><`I`></th><td>*type* __restrict</td></tr> 408 </tbody> 409 </table> 410 411 Modifiers have trailing parameters as follows: 412 413 * *Conditional:* [Qualification without basic name](#element-name), if member 414 * *Conditional:* [CV-class modifier](#element-cvclass) of function, if member function 415 * *Conditional:* [\__based() property](#element-basedprop), if used 416 417 CV-class modifier is usually used in reference/pointer type, but it is also used in other place with some restrictions: 418 419 * Modifier of function: can only have const, volatile attribute, optionally with prefixes. 420 * Modifier of data: cannot have function property. 421 422 423 <h3 id="element-basedprop">\__based() Property</h3> 424 \__based() property represents Microsoft's \__based() attribute extension to C++. This property can be one of the following: 425 426 * <`0`> (means `__based(void)`) 427 * <`2[name]`> (means `__based([name])`, where *name* is [qualification without basic name](#element-name)) 428 * <`5`> (means no `__based()`) 429 430 431 <h3 id="element-function">Function Property</h3> 432 Function property represents prototype of function. It looks like this: 433 434 * Calling convention of function 435 * [Data type](#element-type) of returned value, or <`@`> for void 436 * [Argument list](#element-arglist) 437 * throw() attribute 438 439 The following table shows calling convention of function: 440 441 <table class="centered-cell"> 442 <thead> 443 <tr><th>Code</th><th>Exported?</th><th>Calling Convention</th></tr> 444 </thead> 445 <tbody> 446 <tr><th><`A`></th><td>No</td><td>__cdecl</td></tr> 447 <tr><th><`B`></th><td>Yes</td><td>__cdecl</td></tr> 448 <tr><th><`C`></th><td>No</td><td>__pascal</td></tr> 449 <tr><th><`D`></th><td>Yes</td><td>__pascal</td></tr> 450 <tr><th><`E`></th><td>No</td><td>__thiscall</td></tr> 451 <tr><th><`F`></th><td>Yes</td><td>__thiscall</td></tr> 452 <tr><th><`G`></th><td>No</td><td>__stdcall</td></tr> 453 <tr><th><`H`></th><td>Yes</td><td>__stdcall</td></tr> 454 <tr><th><`I`></th><td>No</td><td>__fastcall</td></tr> 455 <tr><th><`J`></th><td>Yes</td><td>__fastcall</td></tr> 456 <tr><th><`K`></th><td>No</td><td>*none*</td></tr> 457 <tr><th><`L`></th><td>Yes</td><td>*none*</td></tr> 458 <tr><th><`M`></th><td>No</td><td>__clrcall</td></tr> 459 </tbody> 460 </table> 461 462 Argument list for throw() attribute is same to [argument list](#element-arglist), but if this list is <`Z`>, it means there is no throw() attribute. If you want to use `throw()` you have to use <`@`> instead. 463 464 465 <h2 id="function">Function</h2> 466 Typical type information in function name looks like this: 467 468 * *Optional:* Prefix <`_`> (means __based() property is used) 469 * Access level and function type 470 * *Conditional:* [__based() property](#element-basedprop), if used 471 * *Conditional:* adjustor property (as [encoded unsigned number](#element-number)), if thunk function 472 * *Conditional:* [CV-class modifier](#element-cvclass) of function, if non-static member function 473 * [Function property](#element-function) 474 475 The table below shows code for access level and function type: 476 477 <table class="centered-cell"> 478 <thead> 479 <tr><th></th><th>*none*</th><th>static</th><th>virtual</th><th>thunk</th></tr> 480 </thead> 481 <tbody> 482 <tr><th>private:</th><td><`A`>, <`B`></td><td><`C`>, <`D`></td><td><`E`>, <`F`></td><td><`G`>, <`H`></td></tr> 483 <tr><th>protected:</th><td><`I`>, <`J`></td><td><`K`>, <`L`></td><td><`M`>, <`N`></td><td><`O`>, <`P`></td></tr> 484 <tr><th>public:</th><td><`Q`>, <`R`></td><td><`S`>, <`T`></td><td><`U`>, <`V`></td><td><`W`>, <`X`></td></tr> 485 <tr><th>*none*</th><td><`Y`>, <`Z`></td><td></td><td></td><td></td></tr> 486 </tbody> 487 </table> 488 489 This kind of thunk function is always virtual, and used to represent logical `this` adjustor property, which means an offset to true `this` value in some multiple inheritance. 490 491 492 <h2 id="data">Data</h2> 493 Type information in data name looks like this: 494 495 * Access level and storage class 496 * [Data type](#element-type) 497 * [CV-class modifier](#element-cvclass) 498 499 The table below shows code for access level and storage class: 500 501 <table> 502 <thead> 503 <tr><th>Code</th><th>Meaning</th></tr> 504 </thead> 505 <tbody> 506 <tr><th><`0`></th><td>Private static member</td></tr> 507 <tr><th><`1`></th><td>Protected static member</td></tr> 508 <tr><th><`2`></th><td>Public static member</td></tr> 509 <tr><th><`3`></th><td>Normal variable</td></tr> 510 <tr><th><`4`></th><td>Normal variable</td></tr> 511 </tbody> 512 </table> 513 514 CV-class modifier should not be function. 515 516 517 <h2 id="thunkfunction">Thunk Function</h2> 518 There is several kind of thunk function. <small>[TODO: a lot of thunk function!]</small> 519 520 [^0]: Some tables contain two or more entries in one case. In this case, I tried to place more frequently used entry in the front. (But I'm not sure that this placement. Don't ask it for me!) 521 522