digitalmars.D - :wq
- Iain Buclaw (21/21) Jan 02 2014 Given the code:
- Iain Buclaw (3/4) Jan 02 2014 That should be:
- Martin Nowak (4/11) Jan 02 2014 I think we should ignore extern(C) when mangling nested symbols.
- Iain Buclaw (15/35) Jan 02 2014 _D6mangle18runModuleUnitTestsFZb7Console6opCallMFxAaZS6mangle18runModule...
Given the code: module mangle; extern (C) bool runModuleUnitTests() { static struct Console { Console opCall( in char[] val ) { return this; } } return false; } The D frontend will generate the mangled symbol (and its initialiser) as: _D6mangle18runModuleUnitTestsUZb7Console6opCallMFxAaZSrunModuleUnitTests7Console _DrunModuleUnitTests7Console6__initZ Instead of the more desired: _D6mangle18runModuleUnitTestsFZb7Console6opCallMFxAaZS6mangle18runModuleUnitTestsFZb7Console _D18runModuleUnitTest7Console6__initZ Is this desirable? It makes demangling such symbols difficult.
Jan 02 2014
On Thursday, 2 January 2014 at 17:38:30 UTC, Iain Buclaw wrote:_D6mangle18runModuleUnitTestsFZb7Console6opCallMFxAaZS6mangle18runModuleUnitTestsFZb7ConsoleThat should be: _D6mangle18runModuleUnitTestsFZb7Console6opCallMFxAaZS18runModuleUnitTestsFZb7Console
Jan 02 2014
On 01/02/2014 06:38 PM, Iain Buclaw wrote:The D frontend will generate the mangled symbol (and its initialiser) as: _D6mangle18runModuleUnitTestsUZb7Console6opCallMFxAaZSrunModuleUnitTests7Console _DrunModuleUnitTests7Console6__initZ Instead of the more desired: _D6mangle18runModuleUnitTestsFZb7Console6opCallMFxAaZS6mangle18runModuleUnitTestsFZb7Console _D18runModuleUnitTest7Console6__initZ Is this desirable? It makes demangling such symbols difficult.I think we should ignore extern(C) when mangling nested symbols. But we should obey the calling convention. So according to http://dlang.org/abi.html it's UZb instead of FZb.
Jan 02 2014
On 2 Jan 2014 19:50, "Martin Nowak" <code dawg.eu> wrote:On 01/02/2014 06:38 PM, Iain Buclaw wrote:_D6mangle18runModuleUnitTestsUZb7Console6opCallMFxAaZSrunModuleUnitTests7ConsoleThe D frontend will generate the mangled symbol (and its initialiser) as:_D6mangle18runModuleUnitTestsFZb7Console6opCallMFxAaZS6mangle18runModuleUnitTestsFZb7Console_DrunModuleUnitTests7Console6__initZ Instead of the more desired:I should probably rewrite the message as I did it in an awful hurry. ;) The main point was getting across was that in the normal scheme of mangling it follows the convention in a nutshell: TypeStruct QualifiedSymbol (Int Symbol) ... Eg: S6foobar5inner... Should 'foobar' be an extern (C) function, then the initial string count is omitted. Sfoobar5inner Causing core.demangler to choke on it. This affects the demangler I've written for gdb as it follows the same rules to parse the mangled string._D18runModuleUnitTest7Console6__initZ Is this desirable? It makes demangling such symbols difficult.I think we should ignore extern(C) when mangling nested symbols. But we should obey the calling convention. So according to http://dlang.org/abi.html it's UZb instead of FZb.
Jan 02 2014