I want to modify the module erl_prim_loader, but I found that it didn't take effect. This file does not seem to be loaded from $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 :
prim_file
is a prebuilt module that's statically embedded into the emulator, and the emulator crashes if there are any problems initializing it. 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-existentmy_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. 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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.