链接库组件在C ++中意味着什么 [英] What does linking library components mean in C++

查看:47
本文介绍了链接库组件在C ++中意味着什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在C ++应该是如何实现的描述中读到这个:


"所有外部对象和函数引用都已解析。库

组件被链接以满足对函数的外部引用和

当前转换中未定义的对象。所有这样的翻译器输出

被收集到一个程序映像中,该映像包含在执行环境中执行

所需的信息。


我想知道的是我应该理解的意思。

通常当我想到链接时,它意味着安排

的不同部分目标代码,以便符号可以解析为生成的程序集中的相对内存

位置。该标准没有给出库的明确定义,也没有给出一个非常明确的链接概念。

其他人如何阅读那个段落?

-

如果我们的假设是关于任何东西而不是某个或多个特定的东西,那么我们的推论构成了数学。因此,数学可能被定义为我们永远不知道我们所讨论的是什么,以及我们所说的是否属实的主题.- Bertrand Russell

解决方案

Steven T. Hatton写道:

标准没有给出库的明确定义;它也没有给出一个非常明确的链接概念。其他人如何阅读
段落?




标准并不关心这一点。每个操作系统和

工具系列都可以拥有自己的关于链接如何完成以及库存是否存储和处理的概念。


你可以在链接意义上查看一个库,就像以某种方式存储到一个对象

文件一样。


代码可以链接通过将符号解析为相对或绝对地址,

引用动态加载库中的符号......或者可以不将

解析为任何类型的地址,将其延迟到加载或运行时间。


-

Salu2


Steven T. Hatton写道:< blockquote class =post_quotes>我刚刚在C ++应该如何实现的描述中读到这个:


这不是它的假设将要执行。这是标准基于的汇编

模型。不同的编译模型是完全可以接受的,只要它们产生相同的结果。对于

的例子,许多编译器将预处理作为编译的其余部分进行预处理,而不是作为一个单独的阶段。

"解析所有外部对象和函数引用。库
组件被链接以满足对当前翻译中未定义的函数和对象的外部引用。所有这样的翻译器输出都被收集到一个程序映像中,该映像包含在其执行环境中执行所需的信息。

我想知道的是我到底是什么我应该理解这意味着。
通常当我想到链接时,它意味着安排目标代码的不同部分,以便符号可以解析为相关的内存
位置。部件。该标准没有给出库的明确定义,也没有给出一个非常明确的链接概念。
其他人如何读取该段?




这是故意模糊的,以避免不必要的约束。你的阅读

是合理的,大多数实现都是如此处理的。


-


Pete Becker

Dinkumware,Ltd。( http://www.dinkumware .com


Pete Becker写道:

Steven T. Hatton写道:

我刚刚在C ++应该如何实现的描述中读到了这个:



这不是应该如何实现的。那是标准所依据的编译模型。只要它们产生相同的结果,不同的编译模型是完全可以接受的。例如,许多编译器将预处理作为编译的其余部分进行预处理,而不是作为单独的阶段。




那是我的措辞选择不好。我纠正了。它是一个抽象机器的描述

,它定义了实现所需的行为。除了标准具体地说明b / b
表明实施可能会有所偏差。如果我正确地读出了

的措辞,那么实现可能会以相同的起始条件执行相同的程序

,并且每次运行都会产生不同的结果。

正是由于这个原因,抽象机被认为是非确定性的。


我想这与事情有关例如在函数调用参数列表中评估

表达式的顺序。 Stroustrup评论了这个

,上面写着类似于''我被告知这是为了

表现的目的。''这让我想知道他是否真的买了争论。我想知道成本/效益比是多少。

http://www.gotw.ca/gotw/056.htm

" ;解析所有外部对象和函数引用。库
组件被链接以满足对当前翻译中未定义的函数和对象的外部引用。所有这样的翻译器输出都被收集到一个程序映像中,该映像包含在其执行环境中执行所需的信息。

我想知道的是我到底是什么我应该理解这意味着。通常,当我想到链接时,它意味着安排目标代码的不同部分,以便符号可以解析为生成的程序集中的相对位置。该标准没有给出库的明确定义,也没有给出一个非常明确的链接概念。其他人如何阅读该段落?



这是故意模糊的,以避免不必要的约束。你的阅读是合理的,大多数实现都是如此处理它。




我想要的是什么链接的抽象概念,以及

库。我想段落本质上意味着

处理器应该有一些方法来检索或修改

外部引用对象的值,或者调用外部引用的函数。

这个链接可以在最后阶段明确地和不可变地完成

所描述的翻译,或者可以延迟到稍后的时间,

但是存储足够的信息以解决将来的联系。

这可能需要动态加载和链接,以及与执行的远程系统上的另一个进程通信的


函数,或提供变量。

-

如果我们的假设是关于任何事情而不是关于某一个或多个

特定的东西,然后我们的推论构成数学。因此,数学可能被定义为我们永远不知道我们所讨论的是什么,以及我们所说的是否属实的主题.- Bertrand Russell


I just read this in the description of how C++ is supposed to be
implemented:

"All external object and function references are resolved. Library
components are linked to satisfy external references to functions and
objects not defined in the current translation. All such translator output
is collected into a program image which contains information needed for
execution in its execution environment."

What I''m wondering is what exactly I''m supposed to understand that to mean.
Typically when I think of linking, it means arranging different parts of
the object code so that symbols can be resolved to relative memory
locations within the resulting assembly. The standard doesn''t give a clear
definition of "library", nor does it give a very clear notion of "linking".
How do others read that paragraph?
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell

解决方案

Steven T. Hatton wrote:

The standard doesn''t give a clear definition of "library", nor does
it give a very clear notion of "linking". How do others read that
paragraph?



The standard does not care about that. Each operating system and family of
tools can have his own notions about how linking is done and librarys are
stored and handled.

You can view a library, in the linking sense, just as a couple of object
files stored togheter in some way.

Code can be linked by resolving symbols to relative or absolute adresses, to
references to symbols in dynamic loading libraries... Or can be not
resolved to any type of address, delaying that to loading or run time.

--
Salu2


Steven T. Hatton wrote:

I just read this in the description of how C++ is supposed to be
implemented:
That''s not how it''s supposed to be implemented. That''s the compilation
model that the standard is based on. Different compilation models are
perfectly acceptable, as long as they produce the same results. For
example, many compilers do preprocessing as an integral part of the rest
of the compilation, not as a separate phase.

"All external object and function references are resolved. Library
components are linked to satisfy external references to functions and
objects not defined in the current translation. All such translator output
is collected into a program image which contains information needed for
execution in its execution environment."

What I''m wondering is what exactly I''m supposed to understand that to mean.
Typically when I think of linking, it means arranging different parts of
the object code so that symbols can be resolved to relative memory
locations within the resulting assembly. The standard doesn''t give a clear
definition of "library", nor does it give a very clear notion of "linking".
How do others read that paragraph?



It''s deliberately vague, to avoid unnecessary contraints. Your reading
is a reasonable one, and it''s how most implementations handle it.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)


Pete Becker wrote:

Steven T. Hatton wrote:

I just read this in the description of how C++ is supposed to be
implemented:



That''s not how it''s supposed to be implemented. That''s the compilation
model that the standard is based on. Different compilation models are
perfectly acceptable, as long as they produce the same results. For
example, many compilers do preprocessing as an integral part of the rest
of the compilation, not as a separate phase.



That was a bad choice of wording on my part. I stand corrected. It is a
description of an abstract machine which defines the behaviors required of
an implementation. With the exception of where the Standard specifically
states that the implementation may deviate. If I read the wording
correctly, it is possible for an implementation to execute the same program
with the same starting conditions, and produce different results each run.
It is for this reason that the abstract machine is said to be
non-deterministic.

I guess that has to do with things such as the order of evaluation of
expressions in a function call argument list. Stroustrup commented on this
with words similar to ''I''ve been told this is done for purposes of
performance.'' Which makes me wonder if he really buys the argument. I
wonder what the cost/benefit ratio is for that.

http://www.gotw.ca/gotw/056.htm

"All external object and function references are resolved. Library
components are linked to satisfy external references to functions and
objects not defined in the current translation. All such translator
output is collected into a program image which contains information
needed for execution in its execution environment."

What I''m wondering is what exactly I''m supposed to understand that to
mean. Typically when I think of linking, it means arranging different
parts of the object code so that symbols can be resolved to relative
memory
locations within the resulting assembly. The standard doesn''t give a
clear definition of "library", nor does it give a very clear notion of
"linking". How do others read that paragraph?



It''s deliberately vague, to avoid unnecessary contraints. Your reading
is a reasonable one, and it''s how most implementations handle it.



What I''m trying to get at is what the abstract notion of linking, and
library are. I guess what the paragraph essentially means is that the
processor should have some means of retrieving or modifying the value of an
externally referenced object, or calling an externally referenced function.
This linking could be done explicitly and immutably in the final phase in
the described translation, or it could be delayed until some later time,
but storing sufficient information to resolve the linkage in the future.
That could entail anything from dynamically loadding and linking, to
communicating with another process on a remote system which executes the
function, or provides the variable.
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell


这篇关于链接库组件在C ++中意味着什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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