Hot code replacement in erlang

前端 未结 4 2270
栀梦
栀梦 2020-12-23 10:59

I am working on my first real project in erlang, however, this code is simplified for brevity. I want to be able to load a newer version of a file into my project r

4条回答
  •  余生分开走
    2020-12-23 11:18

    While erlang can handle two versions of a module and calling a function with mod:func(...) will always call the latest version of a module (if the function is exported) you still have to load the new version of the module into Erlang system. You can't expect it automagically detect that you happen to have a new version of the module somewhere, find it, compile it and load it.

    N.B. compiling and loading are two separate things. So c(mod). both compiles and loads the module, while l(mod). just loads the object code (.beam file) of the already compiled module. The Erlang compiler is called from the module compile and it just compiles and generates a .beam file while the code loading is handled by the module code.

提交回复
热议问题