[asterisk-dev] Asterisk - 13.6.0 - Registering OWN Module(Application):

Matthew Jordan mjordan at digium.com
Wed Dec 30 10:37:42 CST 2015


On Tue, Dec 29, 2015 at 11:50 PM, Kirill Marchuk <62mkv at mail.ru> wrote:

> Hi Boobalan
>
>  Can you check your code against this one ? (pretty old, but still
> relevant, I guess)
> http://blog.russellbryant.net/2008/06/19/how-to-write-an-asterisk-module-part-1/
>
>  Especially, did you use one of the AST_MODULE_INFO macros ?
>
> Luck !
>
> and Happy New Year!
>
> Kirill Marchuk
>

That blog post is still pretty accurate - we haven't changed the semantics
of loading/registering a module much over the years.

The code in loader.c tells you why this WARNING message is being raised:

    /* the dlopen() succeeded, let's find out if the module
       registered itself */
    /* note that this will only work properly as long as
       ast_module_register() (which is called by the module's
       constructor) places the new module at the tail of the
       module_list
    */
    if (resource_being_loaded != (mod = AST_DLLIST_LAST(&module_list))) {
        ast_log(LOG_WARNING, "Module '%s' did not register itself during
load\n", resource_in);
        /* no, it did not, so close it and return */
        logged_dlclose(resource_in, lib);
        /* note that the module's destructor will call
ast_module_unregister(),
           which will free the structure we allocated in
resource_being_loaded */
        return NULL;
    }

The module's constructor attributes are automatically added by the
aforementioned AST_MODULE_INFO macros. Failure to add those will cause your
module to not be registered, and hence not be loaded.

-- 
Matthew Jordan
Digium, Inc. | Director of Technology
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20151230/e2211425/attachment.html>


More information about the asterisk-dev mailing list