Mangled symbols ending with Z?

Martin Nowak dawg at dawgfoto.de
Sun Dec 4 10:47:35 PST 2011


On Sun, 04 Dec 2011 14:40:47 +0100, Peter Alexander  
<peter.alexander.au at gmail.com> wrote:

> DMD outputs quite a few symbols that end with a Z. For example:
>
> module test;
> class Foo {}
>
> Gives me these three symbols (all .data)
>
> 00013680 D _D4test4Foo16__initZ
> 000136e0 D _D4test4Foo16__vtblZ
> 00013690 D _D4test4Foo17__ClassZ
>
>
> I have two questions:
>
> 1. I know what __init and __vtbl are, but what is __Class?
>
The typeinfo for a specific class, i.e. test.Foo.classinfo which
is an instance of TypeInfo_Class.

> 2. What does the Z at the end mean? The D ABI page doesn't describe this  
> in its grammar, and indeed std.demangle is unable to demangle these  
> symbols. It expects a type there, and Z represents no type.
>
It is used for additional compiler symbols.
Z is used as terminal element for templates and non-variadic function  
arguments.
You may have a look at dmd/src/tocsym.c to find the ones being used for  
compiler symbols.

>
> Once I know this, I will fix std.demangle so that it can parse these.


More information about the Digitalmars-d mailing list