Call Conventions

Jason House jason.james.house at gmail.com
Thu Jan 3 18:46:38 PST 2008


Dan 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

That sounds like a coll feature that D should have.  I have no idea how it'd
get implemented under the hood.



More information about the Digitalmars-d mailing list