从另一个程序集文件调用程序集程序吗? [英] Call assembly procedure from another assembly file?

查看:78
本文介绍了从另一个程序集文件调用程序集程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个简单的问题:

假设我有以下两个汇编程序:

Let's say I had the following two assembly programs:

add10:
   add eax, 10
   ret
;call add5 from other file

2:

add5:
   add eax, 5
   ret
;call add10 from other file

我可以从第二个文件中调用add10(在第一个文件中声明),反之亦然吗?如果是这样,怎么办? (即使不可行)

Could I call add10 (declared in the first file) from the second file, or vice-versa? If so, how can it be done? (even if it isn't feasible)

注意:这将在裸机上运行,​​而不是在任何花哨的NT电话上运行!

NOTE: This will be running on bare metal, not on any fancy NT calls!

谢谢.

我在Windows上使用NASM.

I'm using NASM on Windows.

推荐答案

如果两个文件都链接到同一可执行文件中,则为是.查找EXTERN或EXTRN.

If both files are linked into the same executable, yes. Lookup EXTERN or EXTRN.

这篇关于从另一个程序集文件调用程序集程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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