[asterisk-dev] AST_BUILDOPT_SUM stability
Tzafrir Cohen
tzafrir.cohen at xorcom.com
Tue Dec 4 11:16:00 CST 2012
On Tue, Dec 04, 2012 at 10:47:38AM -0600, Jason Parker wrote:
> 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;
I suppose this has even better chnces of breaking unexpectedly (and
worse: silently) in newer versions of Asterisk, and anyway, is a
larger patch.
--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen at xorcom.com
+972-50-7952406 mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir
More information about the asterisk-dev
mailing list