Call Conventions

Simen Kjaeraas simen.kjaras at gmail.com
Sun Jan 13 15:19:13 PST 2008


Dan <murpsoft at hotmail.com> wrote:
>
> While I must admit it's most probably a very rare thing to need to  
> specify a calling convention; when you do need to it's excrutiating.
>
> For Walnut, I'm currently doing this:
>
> struct Value.sizeof = 16;
>
> Value x(Value self, Value cc, Value[] arguments ...){
> bla bla bla
> }
>
> Now, the way that's getting done by D is absolutely horrid compared to  
> the way I'd like to do it - by taking advantage of XMM registers, using  
> the functions to mutate self, cc, and a third variable which keeps  
> getting returned, while arguments get copied.
>
> I don't understand how I can do that in D without declaring every single  
> function naked, templating in raw assembler, and then processing the  
> function using raw assembler because the variables aren't where D  
> expects.
>
> *sigh*
>
> How about a way to specify call convention and use it via
>
> extern(MyCallConvention)
>
> Would be fabulous.
>
> Regards,
> Dan

I'm sure if we could get downs or Don to work on this, it could be done  
via some funky template mixin - possibly with absurd syntax (downs).

Simen Kjaeraas



More information about the Digitalmars-d mailing list