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
__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
相关文章推荐
- __cdecl、__clrcall、__stdcall、__fastcall、__thiscall、__vectorcall等含义
- 论函数调用约定(stdcall, cdecl, fastcall, thiscall, naked call)
- __cdecl 、__stdcall 、__fastcall、 __pascal 、 __thiscall 的区别
- __stdcall,__cdecl,__fastcall,thiscall,naked call
- WIN32编程:__stdcall,__cdecl,__fastcall,thiscall
- WIN32编程必知:__stdcall,__cdecl,__fastcall,thiscall,naked call
- __cdecl,__stdcall,__fastcall,__pascal,__thiscall 的区别
- WIN32编程必知:__stdcall,__cdecl,__fastcall,thiscall,naked call
- __cdecl、_stdcall 、_fastcall、_thiscall 函数调用方式与区别
- __cdecl、_stdcall、_fastcall、_thiscall
- 几种调用协议的区别__pascal __cdecl __msfastcall __fastcall __stdcall
- ,__stdcall,__cdecl,__fastcall,thiscall,naked call,__pascal
- fastcall,stdcall,thiscall,cdecl学习
- WIN32编程必知:__stdcall,__cdecl,__fastcall,thiscall,na
- _cdecl _stdcall _fastcall _thiscall 待整理
- 区别 __cdecl,__fastcall,__stdcall,thiscall
- 函数调用的区别__stdcall,__cdecl,__fastcall,thiscall,nake
- 函数的调用规则(__cdecl,__stdcall,__fastcall,__pascal, __thiscall)
- 函数调用,__stdcall,__cdecl,__fastcall,thiscall,naked call,__pascal
- Some resources about Calling Conventions - cdecl, stdcall, fastcall, thiscall, etc.