"全球主要的"在大会 [英] "global main" in Assembly

查看:102
本文介绍了"全球主要的"在大会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰到这个片段code来到

I came across this snippet of code:

section .text
    global  main    ;must be declared for linker (gcc)

再有一个就是这条线之后调用主要功能:

and then there is a function called main after this line:

main:    ;tell linker entry point

但我似乎不明白什么全球主要手段,评论似乎并没有多大帮助...

but i don't seem to understand what global main means, and the comment doesn't seem to help much...

我使用本网站以汇编语言程序设计的参考。

i am using this site as a reference to Assembly language programming.

我可以分析指的是功能为主,但我不明白使用的全球关键字...

i can analyse that main refers to the function main, but i don't understand the use of the global keyword...

感谢您提前...

推荐答案

全球主要基本上意味着符号应该是可见的连接器,因为其他的目标文件将使用它。没有它,符号被认为是本地到它的组装到目标文件,并汇编文件装配好后,将不会出现。

global main basically means that the symbol should be visible to the linker because other object files will use it. Without it, the symbol main is considered local to the object file it's assembled to, and will not appear after the assembly file is assembled.

这篇关于"全球主要的"在大会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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