C++ 调用约定
作者:互联网
__cdecl,__stdcall(WINAPI),__fastcall 的区别
(1) __cdecl:C/C++默认方式,参数从右向左入栈,主调函数负责栈平衡。
(2) __stdcall:windows API默认方式,参数从右向左入栈,被调函数负责栈平衡。
(3) __fastcall:快速调用方式。数优先从寄存器传入(ECX和EDX),剩下的参数再从右向左从栈传入。
最为关键的原则
(1) 导出的函数明确指定调用约定,一般为__stdcall
(2) 导出函数,跟调用者保持一致调用约定
(3) 调用约定错误如下(发生如下错误时检查调用约定):
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
标签:__,function,调用,约定,C++,calling,stdcall 来源: https://blog.csdn.net/hallyz945/article/details/114366604