Windows下的调用约定可以是stdcall/cdecl/fastcall,这些标识加在函数名前面,如:int __stdcall funca()但在Linux下,如按照上面写法后,编译程序将导致编译错误,Linux下正确的语法如下:int __attribute__((__stdcall__)) funca()int __attribute__((__cdecl__)) funca()Linux下如果函数不指定调用约定,默认的情况应该是__attribute__((__cdecl__))int __attribute__((__cdecl__)) myfunc(int i, int j, int k)
{
return i+j+k;
} 080483d0 <myfunc>:
80483d0: 55 push %ebp
80483d1: 89 e5 mov %esp,%ebp
80483d3: 8b 45 0c mov 0xc(%ebp),%eax
80483d6: 03 45 08 add 0x8(%ebp),%eax
80483d9: 03 45 10 add 0x10(%ebp),%eax
80483dc: 5d pop %ebp
80483dd: c3 ret
80483de: 66 90 xchg %ax,%ax int __attribute__((__stdcall__)) myfunc(int i, int j, int k)
{
return i+j+k;
} 080483d0 <myfunc>:
80483d0: 55 push %ebp
80483d1: 89 e5 mov %esp,%ebp
80483d3: 8b 45 0c mov 0xc(%ebp),%eax
80483d6: 03 45 08 add 0x8(%ebp),%eax
80483d9: 03 45 10 add 0x10(%ebp),%eax
80483dc: 5d pop %ebp
80483dd: c2 0c 00 ret $0xc Windows XP 和RHEL5 双系统安装记Linux内核软中断线程对于通用内核线程的启示相关资讯 Linux教程
- Linux教程:如何在命令行中查看目 (07/28/2014 12:22:23)
- Linux 修改root密码 (11/03/2012 07:53:38)
- su - root 与su root的区别 (06/06/2012 00:39:40)
| - Linux进程间通信:消息队列 (01/28/2013 09:43:00)
- U盘安装Linux开机无法启动解决方法 (10/07/2012 08:55:52)
- Windows 7/Linux 同步时间 (05/15/2012 06:17:55)
|
本文评论 查看全部评论 (1)