您的位置:首页 > 编程语言 > C语言/C++

MS Visual Studio VC++: Calling Conventions - __cdecl, __stdcall, __fastcall, __thiscall, __clrcall,

2015-01-13 18:04 337 查看
these declaration is Microsoft Specific.

__cdecl is the default calling convention for C and C++ programs. Because the stack is cleaned up by the caller, it can do vararg functions. The __cdecl calling convention creates larger executables than __stdcall, because it requires each function call to
include stack cleanup code. The following list shows the implementation of this calling convention.

Find details in MSDN.

Visual C/C++ compiler calling conventions
http://msdn.microsoft.com/zh-cn/library/984x0h58(v=vs.100).aspx
WINAPI, WINAPIV, CALLBACK, PASCAL etc. are actually macros which are defined in different include files in Microsoft SDK, below is an example:

c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\WinDef.h

#ifdef _MAC

#define CALLBACK PASCAL

#define WINAPI CDECL

#define WINAPIV CDECL

#define APIENTRY WINAPI

#define APIPRIVATE CDECL

#ifdef _68K_

#define PASCAL __pascal

#else

#define PASCAL

#endif

#elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)

#define CALLBACK __stdcall

#define WINAPI __stdcall

#define WINAPIV __cdecl

#define APIENTRY WINAPI

#define APIPRIVATE __stdcall

#define PASCAL __stdcall

#else

#define CALLBACK

#define WINAPI

#define WINAPIV

#define APIENTRY WINAPI

#define APIPRIVATE

#define PASCAL pascal

#endif
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: