[erlang-questions] Dynamic code reloading

Deryk Barker dbarker@REDACTED
Tue Apr 20 08:28:22 CEST 2010


Jeffm wrote:
> When you loaded the new module in the shell did you use c() or 
> l(dbase)? If you compiled external to the shell, as you stated, you'll 
> need to use l(module_name) to tell the shell to load the new version. 
I tried c() which took down the server process. At your suggestion, I 
just tried compiling externally and then used l().

Which worked - the first time, i.e. when all I had done since starting 
the erlang shell was spawn the server and register its name (which was 
definitely in the list returned by registered()). When I recompiled 
externally again and re-used l() it took down the server process...sigh.

I don't understand what's going on here, my understanding of the manual 
was that you can have two versions of a module loaded, the current and 
the old, I should have expected, after the load, the running server to 
be using the old. It successfully switched to the newly loaded code, via 
the call dbase:loop(DataBase), the first time I tried this, so - again, 
as I understand it - it was then using the current.

When I did another load of the module (again using l()), the old old (as 
it were) is purged and the current becomes the old.
So why, if my server process was now running the (about to be old) 
current was it terminated? And why silently?

Any insight gratefully received.

deryk

-- 
|Deryk Barker, Computer Science Dept. | Music does not have to be understood|
|Camosun College, Victoria, BC, Canada| It has to be listened to.           |
|email: dbarker@REDACTED         |                                     |
|phone: +1 250 370 4452               |         Hermann Scherchen.          |




More information about the erlang-questions mailing list