在汇编中调用C函数

在汇编中调用C函数

本文介绍了在汇编中调用C函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管我到处搜索都找不到解决问题的方法.问题是II在C文件"hello.c"中定义了一个函数"hello_world()",我想在程序集中调用此函数文件 . "hello_assembly.asm".有人可以帮助我吗?谢谢.

Despite I searched everywhere I couldn't find any solution to my problem.The problem is that I I defined a function "hello_world() " in a C file "hello.c" and I want to call this function in an assembly file . "hello_assembly.asm" .Can anyone help me ?Thank you.

推荐答案

gcc调用约定

gcc文档应对此进行详细说明.

The gcc documentation should spell this out in more detail.

如果找不到适合您的编译器和环境的文档,建议您将C函数编译为汇编列表,并查看其如何期望传递参数以及退出时在堆栈中保留的内容.

If you couldn't find documentation for your compiler and environment, I'd suggest you compile your C function to an assembler listing and look at how it expects arguments to be passed in and what it leaves on the stack when exiting.

这篇关于在汇编中调用C函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 16:25