开发者

In Erlang how can I compile a module from within a module?

I have tried :

c(module_name).

: but this only works f开发者_如何学运维rom 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜