我想更多地了解"版本号"由GNAT在binder输出文件中创建。他们看起来像这样:
-- The following set of constants give the version
-- identification values for every unit in the bound
-- partition. This identification is computed from all
-- dependent semantic units, and corresponds to the
-- string that would be returned by use of the
-- Body_Version or Version attributes.
-- The following Export pragmas export the version numbers
-- with symbolic names ending in B (for body) or S
-- (for spec) so that they can be located in a link. The
-- information provided here is sufficient to track down
-- the exact versions of units used in a given build.
type Version_32 is mod 2 ** 32;
u00001 : constant Version_32 := 16#8ad6e54a#;
pragma Export (C, u00001, "helloB");
u00002 : constant Version_32 := 16#fbff4c67#;
pragma Export (C, u00002, "system__standard_libraryB");
u00003 : constant Version_32 := 16#1ec6fd90#;
pragma Export (C, u00003, "system__standard_libraryS");
有时这些常数以' B'或者' S'我认为它们代表身体和规范。
我想知道为什么它们首先存在以及何时以及如何使用它们。我无法找到任何强制执行这些检查的选项。
谢谢,
答案 0 :(得分:1)
它们用于跟踪依赖关系。
如果您更改了spec文件,则必须重新编译适当的正文和任何"以及该规范以保持最终的可执行文件一致。
与C和朋友不同,它要求您通过编写正确的Makefile来跟踪所有这些,这种机制会检测并纠正程序依赖项中的更改,通常是强制重新编译所需的任何内容。
(有时,例如,由于文件权限无法编译某些必要的文件,您将收到file xxx out of date because yyy changed, recompile xxx
消息。
上次我看过,Gnu Make的手册大约有340页 - 应该适当地包含在语言大小/复杂性比较中,作为您在C中成功工作所需知识的一部分。
我并不感到惊讶,你无法为此找到Gnat选项。
不应该选择不执行这些检查;我无法看到构建内部不一致的可执行文件的任何用例。
这可能不是您正在寻找的答案。您正在询问有关实施细节的低级问题,没有上下文。或许更好的问题可以解释你想要实现的目标,以及Gnat文档中缺少的内容。