Calling convention)

Source: Internet
Author: User

The cdecl call Convention, also known as the C call Convention, is the default call Convention of C language. Its definition syntax is:
Int func (int x, int y) // default C call Convention
Int _ cdecl func (int x, int y) // specify C call conventions
This call Convention follows the following rules:
Parameter stack order:From right to left
Stack restoration:The caller can modify the stack, so the Variable Parameter Function is supported because the stack balance can be restored.

 

The format stated by the stdcall call Convention. The default format of the driver is the stdcall call Convention:
Int _ stdcall func (int x, int y)
The call conventions of stdcall mean:
Parameter stack inbound rules: ParametersFrom right to leftPush into Stack
Stack restoration:Stack modified by the called Function

 

The Declaration Syntax of fastcall is:
Int fastcall func (int x, int y)
This call Convention follows the following rules:
Parameter stack order: function'sThe first and second parameters are passed through ECx and EDX., Remaining ParametersFrom right to leftInbound Stack
Stack restoration:CalledFunction itselfModify Stack

 

Thiscall is the default call Convention for C ++ class member functions, but it does not display the declaration form. Thiscall means:
Parameter stack entry: the parameter is fromRight-to-left inbound Stack
This pointer goes into the stack: if the number of parameters is determined, this pointer is passed to the caller through ECx; if the number of parameters is not determined, this pointer is pushed to the stack after all parameter stacks are pressed.
Stack recovery:The number of parameters is not fixed,The caller clears the stack.,Otherwise, the function clears the stack by itself.

 

Nakedcall...

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.