[asterisk-dev] AST_BUILDOPT_SUM stability

Jason Parker jparker at digium.com
Tue Dec 4 10:47:38 CST 2012


On 12/04/2012 05:29 AM, Tzafrir Cohen wrote:
> Thanks.
> 
> So what I need is something along the lines of:
> 
>   #include <asterisk/asterisk.h>
> 
>   /* Changes to nullify checksum */
>   #undef AST_BUILDOPT_SUM
>   #define AST_BUILDOPT_SUM ""
> 
>   /* ... */
> 
>   #nclude <asterisk/module.h>
> 
>   /* ... */
> 
>   AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "The name");
> 
> Will it be OK for me to complain if this (redefining AST_BUILDOPT_SUM at
> that specific point) breaks in the future??
> 

The trick is to not set buildopt_sum, which can be achieved by not using the
AST_MODULE_INFO macros.  For the commercial modules that Digium builds, we use
something like the following:

static struct ast_module_info __mod_info = {
        .key = ASTERISK_GPL_KEY,
        .name = "res_tacos",
        .description = "Provides delicious tacos to users",
        .flags = AST_MODFLAG_LOAD_ORDER,
        .load = load_module,
        .unload = unload_module,
        .reload = reload_module,
};

static void  __attribute__ ((constructor)) __reg_module(void)
{
        ast_module_register(&__mod_info);
}

static void  __attribute__ ((destructor)) __unreg_module(void)
{
        ast_module_unregister(&__mod_info);
}

const static struct ast_module_info *ast_module_info = &__mod_info;



More information about the asterisk-dev mailing list