Review Board 1.7.16

Add 'optional API' support to eliminate need for registration of loadable APIs

Review Request #62 - Created Nov. 19, 2008 and submitted

Kevin Fleming
On systems where GCC provides both weak symbols and symbol aliases (pretty widely available), use a combination of them to provide automatically used (or avoided) stub functions for loadable APIs. This patch includes usage of this technique for ast_agi_register() only, but the technique could be used for all loadable APIs (res_musiconhold, res_adsi, res_odbc, etc).

This technique allows the consumer of the API to safely tell whether any module providing the API has been loaded or not, and then tailor its operation to take that result into account. For app_stack, this means it can optionally register its AGI command; for other modules that depend on the loadable API, they could issue an appropriate error message and safely exit when the loadable API is not present.
Compile testing
Review request changed
Updated (Nov. 26, 2008, 8:33 a.m.)
optional_api.h is now included in the diff. all AGI API calls are now documented. all AGI API calls are optional now, since we can't rely on lazy symbol resolution with all linkers. app_stack no longer has to 'remember' whether it registered with AGI or not, since ast_agi_unregister() will do the right thing in all cases.
Ship it!
Posted (Nov. 26, 2008, 8:57 a.m.)
Nice job setting a great example with good documentation!  :-) runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to