在GCC中,stdcall是否有等效功能? [英] Is there any equivalent for stdcall in GCC?

查看:336
本文介绍了在GCC中,stdcall是否有等效功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用GCC在我自己的内核上工作,并且当从asm代码调用C函数时,我必须自己做add esp,xx.经过一番搜索,我发现stdcall是Microsoft的发明,不能在GCC中使用它.有什么方便的方法可以完成这项工作吗?

I'm working on my own kernel using GCC, and when calling C functions from asm code, I have to do add esp,xx myself. After some searching I found that stdcall is a Microsoft invention and can't use it in GCC. Is there any handy way to do this work?

推荐答案

Linux中的stdcall是否等效?

Is there any equivalence of stdcall in linux?

我在Linux环境中的内核

my kernel in a linux environment

等等,这是您自己的内核还是Linux内核?因为如果它是您自己的内核,那么它​​将不再是Linux.

Wait, is this your own kernel, or the Linux kernel? Because if it's your own kernel, it's not Linux any more.

  1. 如果您使用的是Linux,则需要遵循常规的调用约定并编写要匹配的程序集.

  1. If you're working on Linux, you'll want to stick with regular calling conventions and write your assembly to match.

如果您使用自己的内核,则可以做任何您想做的事情. GCC和Clang都支持ix86处理器上的stdcall调用约定,例如

If you're working on your own kernel, you can do anything you want. GCC and Clang both support stdcall calling conventions on ix86 processors, e.g.,

 #define stdcall __attribute__((stdcall))

请参阅:函数属性(GCC手册)

这篇关于在GCC中,stdcall是否有等效功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆