C/C ++ function call conventions

Source: Internet
Author: User

Call Method

Parameter transfer

Clear Stack

Variable Length Parameter supported

Objects used

Function Name Modification

(Name-decoration Convention)

Others

_ Cdecl

From right to left

Caller

Supported

C/C ++ default call Method

The name of the function is prefixed with an underscore (_ main ).

The generated code is larger than stdcall because each function call must contain the code for clearing the stack.

_ Stdcall

From right to left

Called

Not Supported

Use of export functions in Win32 API and DLL

Starts with an underscore, the function name, the @ symbol, and the total number of bytes of the parameter. For example, int F (int A, double B) is named _ f @ 12.

 

 

_ Fastcall

Put it in EDX and ECx first, from right to left

Called

Not Supported

 

Start with @, the function name, And the @ symbol is the total number of bytes of the parameter, for example, @ f @ 12.

 

Fast parameter passing, that is, quick call

Thiscall

From right to left, this pointer is placed in ECx

Called

Not Supported

C ++ is dedicated to member functions to support this pointer.

 

 

This document is compiled based on msdn.

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.