简体   繁体   English

如何修改 erts 模块

[英]How to modify erts modules

I want to modify the module erl_prim_loader, but I found that it didn't take effect.我想修改模块erl_prim_loader,但是发现没有生效。 This file does not seem to be loaded from $ERL_ROOT/lib/erts-10.1/ebin/erl_prim_loader.beam这个文件似乎不是从$ERL_ROOT/lib/erts-10.1/ebin/erl_prim_loader.beam

This is a preloaded module, so there is an extra step to make modifications take effect.这是一个预加载的模块,因此需要额外的步骤才能使修改生效。 From a message by John Högberg to erlang-questions on 2019-04-29 :John Högberg 到 2019-04-29 的 erlang-questions 的消息

prim_file is a prebuilt module that's statically embedded into the emulator, and the emulator crashes if there are any problems initializing it. prim_file是一个预先构建的模块,它静态地嵌入到模拟器中,如果在初始化时出现任何问题,模拟器就会崩溃。 In this case you've added a function to the NIF but haven't yet rebuilt the module, so it crashes when trying to inject the non-existent my_truncate_nif/1 .在这种情况下,您已向 NIF 添加了一个函数,但尚未重建模块,因此在尝试注入不存在的my_truncate_nif/1时它会崩溃。

To update these prebuilt modules, you need to run:要更新这些预构建的模块,您需要运行:

 ./otp_build update_preloaded --no-commit

Try doing this on a clean build without changes to the NIF (C code), and then rebuild the emulator with the changes applied.尝试在不更改 NIF(C 代码)的干净构建中执行此操作,然后使用应用更改重新构建模拟器。 Note that you will need to rebuild the emulator every time you update the preloaded modules for the changes to take effect.请注意,每次更新预加载的模块时,您都需要重建模拟器以使更改生效。

Hope that helps!希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM