two mains

Tyro[17] nospam at home.com
Sat Jan 26 12:57:54 PST 2013


On 1/26/13 3:42 PM, Tyro[17] wrote:
[Snip]
>
> Both segments of code deal with a minimal D program: the first taking no
> arguments and the second taking a string array. Information prior to the
> ".text_Dmain segment" in both files mirror each other with the exception
> of module name differences.
>
> The first difference that jumps out at me is that the ".text._Dmain
> segment" in [1] properly terminates with ".text._Dmain ends" like all
> other segments in the file up to this point. [2] is improperly:
> ".text._Dm".

[1] This seems to be a problem with the disassembler @DPaste

> The second is the use of leave in [2]. If I understand correctly, leave
> is the exact same as:
>
>          mov    RBP,RSP
>          pop    RBP
>
> So why do we need to mov RBP, RSP in [2] but not in [1]? I'm thinking
> this is because RBP contains the address of args but not sure.

Still not clear on this choice.

> Last is the .cto at the end of [1], what on earth is it and what is it
> used for? Why does it not exist in [2]?

See [1] above.

> Thanks,
> Andrew


More information about the Digitalmars-d-learn mailing list