While working on ejabbered, I came across a case where I had to compile a new module.
On googling and reading around stuff, I went through different posts -
the include commands.
So now, after addiing
On googling and reading around stuff, I went through different posts -
- http://sacharya.com/writing-ejabberd-modules/
- http://anders.conbere.org/blog/2008/07/17/building_ejabberd_modules_-_part_2_-_generic_modules/
- http://stackoverflow.com/questions/8392326/intercept-login-logout-ejabberd
- http://uhlenheuer.net/posts/2013-01-16-writing_an_ejabberd_module.html
All of these posts were indeed very helpful to start but I faced some errors to compile , even after following the given steps.
My basic mod_hello.erl module, had
-module(mod_hello).
-behavior(gen_mod).
-export([
start/2,
stop/1
]).
start(_Host, _Opt) ->
?INFO_MSG("Loading module 'mod_hello' ", []).
stop(_Host) ->
ok.
Using commands to compile this ,
erlc mod_hello.erlBut nothing worked. I looked at the compiling commands that Ejabbered src used on compiling its erl modules. It was similiar to mine. Atlast on looking through the code, I found out the missing code..
erlc -I {erlang_src_dir}/src -pa {erlang_src_dir}/src mod_hello.erl
the include commands.
So now, after addiing
-include("ejabberd.hrl").
-include("jlib.hrl").
Everything worked. Hooray..
No comments:
Post a Comment