Erlang Beam 文件的便携性如何?

发布于 2024-08-21 03:10:06 字数 84 浏览 8 评论 0原文

我遇到了一种临时情况,beam 文件在一个节点上编译 在另一个节点上执行。光束文件是否可移植?

Erlang 发行版的版本需要有多接近?

I have a temporary situation where beam files compiled on one node
are executed on another node. Are the beam files portable?

How close do the versions of the Erlang distributions need to be?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

书信已泛黄 2024-08-28 03:10:06

Beam 文件可以跨节点移植,因为它们是由 Erlang VM 解释的字节码,与 Java 的工作方式相同。例外情况是,如果它们是针对本机优化 (+native) 进行编译的,在这种情况下,除了可能在 Windows 计算机之间进行之外,它们显然不是很可移植。 (两年后编辑:还有具有相同硬件和软件设置的机器,就像您在 erlang 的电信使用中可能会发现的那样)

就版本而言,很明显您不应该使用最旧版本不支持的功能。只要支持功能,即使版本差距很大,也应该可以使用。

另请注意,某些模块可能在早期版本中是实验性的,因此它们的功能可能会产生略有不同的结果。

Beam files are portable across nodes, as they are bytecode that is interpreted by the Erlang VM, in the same way that Java works. The exception is if they're compiled for native optimization (+native), in which case they're obviously not very portable, other than possibly between windows machines. (edit two years later: also machines that have identical hardware and software setups, as you would possibly find in telecom uses of erlang)

Version wise, it's obvious that you shouldn't use features that the oldest version doesn't support. As long as the features are supported, it should work even if the version gap is big.

Note also that some modules may have been experimental in earlier versions, and so their functions may have had slightly different results.

咋地 2024-08-28 03:10:06

Beam 文件应该能够在节点之间相当可移植。如果节点运行不同版本的 Erlang VM,那么您可能会遇到麻烦。要特别警惕的功能包括参数化模块的使用和 -extends() 模块属性。如果其中一台机器正在运行通过包管理器(即 apt)安装的 VM,则它可能很旧。我过去遇到困难的一个模块是正则表达式模块re

Beam files should be fairly portable across nodes. If nodes are running different versions of the Erlang VM, then you might have troubles. Features to be especially wary of include the use of parameterized modules and the -extends() module attribute. If one of the machines is running a VM that was installed via a package manager (i.e. apt), it's probably old. One module that I've had difficulty with in the past is the regular expression module re.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文