_cdecl,_stdcall,_fastcall 三种调用约定
来源:互联网 发布:星际争霸2 战术 知乎 编辑:程序博客网 时间:2024/04/29 16:57
</pre><p>头文件代码:</p><pre code_snippet_id="500324" snippet_file_name="blog_20141029_3_748927" name="code" class="cpp">void _cdecl demo_cdecl(int, int, int){};void _stdcall demo_stdcall(int, int, int){};void _fastcall demo_fastcall(int, int, int){};源文件代码:
#include "test.h"void main(){calling_convention();//调用3种约定}void calling_convention(){demo_cdecl(1,2,3);demo_stdcall(1, 2, 3);demo_fastcall(1, 2, 3);}反汇编代码:
.text:004133C0 ; void __cdecl calling_convention().text:004133C0 ?calling_convention@@YAXXZ proc near ; CODE XREF: calling_convention(void)j.text:004133C0.text:004133C0 var_C0 = byte ptr -0C0h.text:004133C0.text:004133C0 push ebp.text:004133C1 mov ebp, esp.text:004133C3 sub esp, 0C0h.text:004133C9 push ebx.text:004133CA push esi.text:004133CB push edi.text:004133CC lea edi, [ebp+var_C0].text:004133D2 mov ecx, 30h.text:004133D7 mov eax, 0CCCCCCCCh.text:004133DC rep stosd.text:004133DE push 3 ; __formal.text:004133E0 push 2 ; __formal.text:004133E2 push 1 ; __formal.text:004133E4 call j_?demo_cdecl@@YAXHHH@Z ; demo_cdecl(int,int,int).text:004133E9 add esp, 0Ch.text:004133EC push 3 ; __formal.text:004133EE push 2 ; __formal.text:004133F0 push 1 ; __formal.text:004133F2 call j_?demo_stdcall@@YGXHHH@Z ; demo_stdcall(int,int,int).text:004133F7 push 3 ; __formal.text:004133F9 mov edx, 2 ; __formal.text:004133FE mov ecx, 1 ; __formal.text:00413403 call j_?demo_fastcall@@YIXHHH@Z ; demo_fastcall(int,int,int).text:00413408 pop edi.text:00413409 pop esi.text:0041340A pop ebx.text:0041340B add esp, 0C0h.text:00413411 cmp ebp, esp.text:00413413 call j___RTC_CheckEsp.text:00413418 mov esp, ebp.text:0041341A pop ebp.text:0041341B retn.text:0041341B ?calling_convention@@YAXXZ endp
经常看到游戏里面的代码 mov edx,xxx 、mov ecx,xxxx 然后call xxxx 原来是fastcall参数来的。
0 0
- _cdecl,_stdcall,_fastcall 三种调用约定
- 函数调用约定:_stdcall,_cdecl,_fastcall
- 函数调用约定:_stdcall、_cdecl、_fastcall
- 函数调用约定详解:_stdcall,_cdecl,_fastcall
- 函数调用约定:_stdcall,_cdecl,_fastcall
- VC++环境下的调用约定:_cdecl _stdcall _fastcall thiscall
- 调用约定__stdcall,__cdecl,_cdecl,_stdcall,__fastcall,_fastcall 区别简介
- 函数的调用约定(_cdecl,_stdcall,_fastcall,_pascal)
- _stdcall、_cdecl、 _fastcall 调用区别
- _STDCALL&_CDECL 调用约定
- _STDCALL&_CDECL 调用约定
- 调用约定:_stdcall,_cdecl
- _STDCALL&_CDECL 调用约定
- 函数调用约定,_cdecl,_stdcall
- _cdecl与_stdcall调用约定
- _stdcall _cdecl _fastcall
- _stdcall _cdecl _pascal _fastcall
- _stdcall、_cdecl与_fastcall
- 规范发的士大夫是的浮士德够好过大
- 使用jquery生成页面的二维码
- 涉足计算机视觉领域要知道的~ (part1)
- 爱飞的云的收藏夹天地
- 关于重载问题
- _cdecl,_stdcall,_fastcall 三种调用约定
- Context类中openFileOutput ()函数的使用
- 使用socket传输jpeg图片,传输若干帧后发现很卡,有时传输一帧图像需要几秒钟
- iOS Data Storage Guidelines 和 "do not back up"文件属性
- Linux下CAN总线速率设置,socketCAN。
- hdu 3572 Task Schedule 【网络最大流】
- 招行信用卡微信公众号开发高级篇
- java自带线程池和队列详细讲解
- github秘籍,为你解读Git与Github酷而少知的功能