[asterisk-dev] loading modules help
Mark Michelson
mmichelson at digium.com
Fri Aug 21 13:47:36 CDT 2009
Boehm, Matthew wrote:
> Hello,
>
> I’m trying to understand how the modules are loaded in asterisk. I can
> see that every module has a “load_module” and “unload_module” function.
> And I can see in main/loader.c in the load_dynamic_module() function the
> call to dlopen() on the module.so file path.
>
>
>
> But what I am not seeing is where the just-loaded-module’s “load_module”
> function is called, which registers the module and its functions to the
> main core lists.
>
>
>
> Take, for example, app_mp3. I type “module load app_mp3.so” which calls
> main/cli:handle_load(), which passes to main/loader:ast_load_resource(),
> then main/loader:load_resource then main/loader:load_dynamic_module()
> which then calls the dlopen().
>
>
>
> But again, nowhere along that path do I see anything calling app_mp3’s
> load_module() function.
>
>
> What am I missing?
>
>
>
> Many thanks,
>
> Matthew
>
Towards the end of main/loader:load_resource, start_resource() is called. Then,
near the beginning of that function, you'll see a call to mod->info->load().
This function pointer was assigned to app_mp3's load_module function using the
AST_MODULE_INFO_STANDARD macro at the bottom of app_mp3.c.
Mark Michelson
More information about the asterisk-dev
mailing list