为什么使用$ L指令链接的目标文件的顺序很重要? [英] Why does the order of linked object file with $L directive matter?

查看:110
本文介绍了为什么使用$ L指令链接的目标文件的顺序很重要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用静态链接的sqlite数据库,为了编译每个下一个版本,有时我必须对所使用的目标文件列表进行较小的更改. 但是有时候我必须做出的改变使我感到困惑. 例如,在版本3_6_10之前,此订单

{$L 'Objs\is.OBJ'}
{$L 'Objs\mbisspc.OBJ'}

可以,但是从3_6_12开始,链接器说

unsatisfied forward or external declaration _isspace

但将顺序更改为

{$L 'Objs\mbisspc.OBJ'}
{$L 'Objs\is.OBJ'}

有帮助. 至于sqlite中的更改,它实际上停止了在3_6_12中使用c函数isspace并开始使用内部等效项,因此"isspace"关键字甚至不会出现在obj文件中.

那么,为什么使用$ L指令链接对象文件的顺序很重要,我在哪里可以了解到更多信息呢?我想这与列出的obj文件的交叉使用有关,但是如果我了解发生了什么,我会感到更加安全

谢谢

解决方案

截至 David Heffernan 的评论,链接到. com/questions/4638186/error-while-linking-multiple-c-object-files-in-delphi-2007>在Delphi中链接.obj文件的问题,我将linker替换为compiler,并在下面添加了 italic 部分:

C编译器使用一次多遍 linker 编译器,该编译器知道如何解决.obj文件之间的正向和循环依赖性.

由于Delphi linker 编译器针对的是Delphi语言,而Delphi语言不允许这样做,因此 linker 编译器也不允许这种情况. /p>

Pro: linker 编译器要快得多.

缺点:您需要通过按正确的顺序放置.obj文件来对 linker 编译器有所帮助
,或通过手动解决依赖关系(请参见上述

So why does the order of linked object file with $L directive matter and where I can read more about this? I suppose it is something related to cross-usage of the listed obj files, but I will feel more safe if I understand what is going on

Thanks

解决方案

Edit:

As of the comment by David Heffernan linking to his answer to this other question on linking .obj file in Delphi, I replaced linker by compiler, and added a the italic portion below:

C compilers use a multi-pass linker compiler that knows how to resolve forward and circular dependencies between .obj files.

Since the Delphi linker compiler is targeted at the Delphi language, and the Delphi language does not allow for that, the linker compiler does not allow for this either.

Pro: the linker compiler is much faster.

Con: you need to help the linker compiler a bit by placing the .obj files in the right order
, or by manually resolving the dependencies (see the above mentioned answer by David Heffernan) .

--jeroen

这篇关于为什么使用$ L指令链接的目标文件的顺序很重要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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