Tuesday, September 3, 2013

Compiling Ejabbered Module

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 -



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.erl
erlc  -I {erlang_src_dir}/src -pa {erlang_src_dir}/src mod_hello.erl
 But 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..
the include commands.

So now, after addiing
-include("ejabberd.hrl").
-include("jlib.hrl").
Everything worked. Hooray.. 

No comments:

Post a Comment