[Asterisk-Dev] LOCAL_USER cleanup update

Kevin P. Fleming kpfleming at digium.com
Thu Jan 12 07:24:34 MST 2006


Luigi Rizzo wrote:

> ouch... just realised that to achieve this, the load_module() function
> requires an argument (a pointer to the module descriptor), that in
> turn needs to be passed to the various ast_register_*() calls,
> so that the dispatcher knows where the refcounts etc are.
> In C++ we would just use "this", but in C we don't have it :(
> Anyways, there is a relatively easy workaround because we can
> use the function address as a search key in the module's list.
> Unfortunately, this is a bit more intrusive than i expected...

In the Linux kernel they use a macro named THIS_MODULE for this purpose; 
you may want to take a look and see how it is implemented.



More information about the asterisk-dev mailing list