Call Conventions

Dan murpsoft at hotmail.com
Thu Jan 3 06:25:44 PST 2008


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



More information about the Digitalmars-d mailing list