为什么使用 $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 文件的交叉使用有关,但如果我了解发生了什么,我会感到更安全,
谢谢
I use statically linked sqlite database and in order to compile every next version I sometimes have to do minor changes in the list of object files used.
But sometimes the changes I have to make puzzles me.
For example prior to version 3_6_10 this order
{$L 'Objs\is.OBJ'}
{$L 'Objs\mbisspc.OBJ'}
was ok, but starting 3_6_12 the linker said
unsatisfied forward or external declaration _isspace
but changing the order to
{$L 'Objs\mbisspc.OBJ'}
{$L 'Objs\is.OBJ'}
helped.
As for the changes in sqlite, it really stopped to use c function isspace in 3_6_12 and started to use an internal equivalent so "isspace" keyword even don't appear inside the obj file.
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:
截至 David Heffernan 发表评论,链接到 他对另一个关于在Delphi中链接.obj文件的问题,我替换了
linker
bycompiler
,并添加了下面的斜体部分:C 编译器使用多遍
linker编译器,它知道如何解决 .obj 文件之间的前向和循环依赖关系。由于Delphi
linker编译器是针对Delphi语言的,而Delphi语言不允许这样做,所以linker编译器也不允许这样做。优点:
linker编译器速度更快。缺点:您需要通过按正确的顺序放置 .obj 文件来帮助
linker编译器,或者通过手动解决依赖关系(请参阅上面提到的 大卫·赫弗南的回答)
。
——杰罗恩
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
bycompiler
, and added a the italic portion below:C compilers use a multi-pass
linkercompiler that knows how to resolve forward and circular dependencies between .obj files.Since the Delphi
linkercompiler is targeted at the Delphi language, and the Delphi language does not allow for that, thelinkercompiler does not allow for this either.Pro: the
linkercompiler is much faster.Con: you need to help the
linkercompiler 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