I have an Erlang application (for now just a few library modules) bundled up under Rebar. Directory structure looks like this:
MyProject
- apps
-- myapp
--- ebin
--- src
--- yada
- rebar
- rebar.conf
MyProject$ ./rebar compile responds as expected.
I open up the Erlang shell ( MyProject$ erl -pa apps/*/ebin myapp ) and can execute exported function just fine.
Now I edit a source file, add an exported function, and recompile. But, whaaa--- when I try to execute my new exported function, I get an error--- undefined function. I execute myAppModule:module_info/0 in the Erlang shell. It doesn't list the new function I'd just added to my source file, nor changes I'd made to other functions.
I delete relevant *.beam file and recompile. Still can't see my changes.
But, now I q() out of the Erlang shell and re-enter. What do you know! All works fine, including my new function.
Why should this be?
How do you recompile? From the shell or how?
Note that if you recompile the file "outside" of the executing erlang then you will explicitly have to reload the module (with a l(myAppModule).
) in the shell. If you recompile from the shell (with a c(myAppModule).
) then the module will be recompiled and reloaded but the .beam
file will not be put in the ebin
directory but will be in the current working directory.