简体   繁体   中英

In Erlang how can I compile a module 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.

您可能希望查看编译模块和特定的compile:file / 2函数。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM