今天来学习FreeSWITCH 加载模块过程。
哪些模块需要编译,是由源码下的 modules.conf 文件决定的。
哪些模块在程序启动时自动加载,是由 freeswitch/conf/autoload_configs/modules.conf.xml 决定的。
switch.c--main()
----> switch_core.c --switch_core_init_and_modload()
---->switch_loadable_module.c --switch_loadable_module_init()
---->switch_loadable_module.c --switch_loadable_module_load_module_ex(最底层的加载函数)
#define SWITCH_MODULE_LOAD_FUNCTION(name) switch_status_t name SWITCH_MODULE_LOAD_ARGS
#define SWITCH_MODULE_LOAD_ARGS (switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool)
SWITCH_MODULE_LOAD_FUNCTION(mod_tts_commandline_load)
等价于:
unsigned int mod_tts_commandline_load (switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool)