[asterisk-dev] Module to Asterisk function Compiler Issue question

Kevin P. Fleming kpfleming at digium.com
Mon Aug 1 09:59:55 CDT 2011


On 08/01/2011 09:52 AM, Mike Myhre wrote:
>     By default, functions are not exported from Asterisk modules other
>     than res_* modules. There are two factors controlling this: the
>     flags in the AST_MODULE_INFO macro call at the end of the module
>     source file, and the '.exports' file for the module in question. In
>     order to export symbols from a module, you'll need to modify these
>     areas to be similar to the way that res_* modules are configured.
>
> I don't see any .exports file anywhere in the source files, so I am
> guessing it doesn't apply. The AST_MODULE_INFO macro appears to handle
> only constructor, destructor and a reload. There are hundreds of
> functions similar to the one I am trying to export, yet mine never makes
> it to the asterisk binary.

You did not read my statement completely; it's the *FLAGS* passed to the 
AST_MODULE_INFO macro that have an effect on whether symbols from the 
module are visible once it is loaded in Asterisk or not. I could have 
told you specifically what to change, but I was trying to help you 
learn. For a hint, grep for 'GLOBAL_SYMBOLS' in the source tree.

You are correct about the exports files; you don't need to worry about 
them with 1.6.2.x, but you will in 1.8 and later.

> So... Why aren't my functions making it from the .so file to the
> asterisk binary? I would think that if they made it to the .so they
> would make it to the final binary.

Your module is not included in the Asterisk main binary; it's a dynamic 
module loaded at run time. The symbol visibility is controlled by the 
module loader, via the flags that I mentioned above.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
Jabber: kfleming at digium.com | SIP: kpfleming at digium.com | Skype: kpfleming
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list