Register calling convention for asm functions...

Daniel Keep daniel.keep.lists at gmail.com
Mon Mar 12 18:47:24 PDT 2007


Mikola Lysenko wrote:
> Chris Warwick wrote:
>> What do i need to do to get register calling convention for asm? I've
>> found extern(C) for cdecl calling convention, and i have seen mention
>> of the 'naked' keyword but cant work out where it goes... im not even
>> sure if it does cause register calling convention or just causes the
>> compiler to omit entry and exit code.
>>
>> I assume it must be possible to write asm functions that take
>> arguments in the eax,ecx,edx registers?
>>
>> thanks,
>>
>> cw
>>
> 
> Yes, and no.  The D calling convention differs from compiler to
> compiler.  GDC uses an extension of extern(C), while DMD follows a
> convention similar to Win32's stdcall.  As a result, this makes it a bad
> idea to use 'naked' within a D function.
> 
> Hope this helps.
> 
> -Mik

I don't think it's supposed to differ, at least on the same platform.  I
think the main problem was that D's calling convention wasn't actually
written down anywhere until fairly recently.

That said, I have no idea if there are plans to make GDC use the same
calling convention as DMD...

	-- Daniel

-- 
Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/


More information about the Digitalmars-d-learn mailing list