1

Rebar の下にバンドルされた Erlang アプリケーション (今のところ、ほんの数個のライブラリ モジュール) があります。ディレクトリ構造は次のようになります。

MyProject  
- apps  
-- myapp  
--- ebin  
--- src  
--- yada   
- rebar  
- rebar.conf  

MyProject$ ./rebar compile は期待どおりに応答します。

Erlang シェル ( MyProject$ erl -pa apps/*/ebin myapp ) を開くと、エクスポートされた関数を問題なく実行できます。

次に、ソース ファイルを編集し、エクスポートされた関数を追加して、再コンパイルします。しかし、なんと --- 新しくエクスポートした関数を実行しようとすると、エラーが発生します --- 未定義の関数です。Erlang シェルで myAppModule:module_info/0 を実行します。ソースファイルに追加したばかりの新しい関数も、他の関数に加えた変更もリストされていません。

関連する *.beam ファイルを削除して再コンパイルします。まだ私の変更を見ることができません。

しかし、今は Erlang シェルから q() 出て、再入力します。あなたは何を知っていますか!私の新しい機能を含め、すべて正常に動作します。

なぜこれが必要なのですか?

4

1 に答える 1

6

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.

于 2012-08-04T17:29:50.853 に答える