1、int __cdecl Plus(int a, int b)
{
return a+b;
}
push 2
push 1
call @ILT+15(Plus) (00401014)
add esp,8
2、int __stdcall Plus(int a, int b)
{
return a+b;
}
push 2
push 1
call @ILT+10(Plus) (0040100f)
函数内部:
ret 8
3、int __fastcall Plus(int a, int b)
{
return a+b;
}
mov edx,2
mov ecx,1
call @ILT+0(Plus) (00401005)
函数内部:
ret
4、int __fastcall Plus4(int a, int b,int c,int d)
{
return a+b+c+d;
}
push 4
push 3
mov edx,2
mov ecx,1
call @ILT+5(Plus) (0040100a)
函数内部:
ret 8
本文介绍了在不同调用约定下(__cdecl、__stdcall 和 __fastcall)加法函数的具体实现方式及其对应的汇编代码。通过对比三种调用约定下参数传递和清理调用栈的方式,帮助读者理解不同约定的特点。
643

被折叠的 条评论
为什么被折叠?



