八叶草

学习资料记录

VC++ 类成员函数 stdcall cdecl thiscall

class Test
{
public:
 void __stdcall Fun1(int){

 }

 void __cdecl Fun2(int){

 }

 void Fun3(int){

 }

};


int _tmain(int argc, _TCHAR* argv[])
{
 Test t;
 t.Fun1(1);
 t.Fun2(2);
 t.Fun3(3);

 return 0;
}

 void __stdcall Fun1(int){
004113C0  push        ebp 
004113C1  mov         ebp,esp 
004113C3  sub         esp,40h 
004113C6  push        ebx 
004113C7  push        esi 
004113C8  push        edi 

 }
004113C9  pop         edi 
004113CA  pop         esi 
004113CB  pop         ebx 
004113CC  mov         esp,ebp 
004113CE  pop         ebp 
004113CF  ret         8 



 void __cdecl Fun2(int){
004113E0  push        ebp 
004113E1  mov         ebp,esp 
004113E3  sub         esp,40h 
004113E6  push        ebx 
004113E7  push        esi 
004113E8  push        edi 

 }
004113E9  pop         edi 
004113EA  pop         esi 
004113EB  pop         ebx 
004113EC  mov         esp,ebp 
004113EE  pop         ebp 
004113EF  ret 


 void Fun3(int){
00411400  push        ebp 
00411401  mov         ebp,esp 
00411403  sub         esp,44h 
00411406  push        ebx 
00411407  push        esi 
00411408  push        edi 
00411409  mov         dword ptr [ebp-4],ecx 

 }
0041140C  pop         edi 
0041140D  pop         esi 
0041140E  pop         ebx 
0041140F  mov         esp,ebp 
00411411  pop         ebp 
00411412  ret         4 


int _tmain(int argc, _TCHAR* argv[])
{
00411370  push        ebp 
00411371  mov         ebp,esp 
00411373  sub         esp,44h 
00411376  push        ebx 
00411377  push        esi 
00411378  push        edi 
 Test t;
 t.Fun1(1);
00411379  push        1 
0041137B  lea         eax,[t] 
0041137E  push        eax 
0041137F  call        Test::Fun1 (411131h) 
 t.Fun2(2);
00411384  push        2 
00411386  lea         eax,[t] 
00411389  push        eax 
0041138A  call        Test::Fun2 (4110D2h) 
0041138F  add         esp,8 
 t.Fun3(3);
00411392  push        3 
00411394  lea         ecx,[t] 
00411397  call        Test::Fun3 (41107Dh) 

 return 0;
0041139C  xor         eax,eax 
}
0041139E  pop         edi 
0041139F  pop         esi 
004113A0  pop         ebx 
004113A1  mov         esp,ebp 
004113A3  pop         ebp 
004113A4  ret 




posted on 2010-11-13 12:16 八叶草 阅读(952) 评论(1)  编辑 收藏 引用 所属分类: C++

评论

# re: VC++ 类成员函数 stdcall cdecl thiscall 2010-11-21 20:49 李现民

这个对比非常好, 呵呵  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理