I have tried :
c(module_name).
: but this only works from the shell, and gives an error when I try to run it from within a module.
I have tried :
c(module_name).
: but this only works from the shell, and gives an error when I try to run it from within a module.
If you want exactly that behaviour, c:c(module_name)
will call the same function called by the shell. I would hesitate to put code that calls user_default (c
) functions in production code, so you might want to look at the source for the function and replicate it in your own code so you don't get bitten by a behaviour change in a future erlang release.
You might want to have a look to the compile module and to the compile:file/2 function in specific.