If you are developing code in the SIL code, the module usually is getting loaded to the server during the Initialization Phase 1 before the startup configuration is loaded into the running configuration database,
and before the running configuration is loaded. The following code illustrates how the module pointer can be obtained during the module load procedure:
/******************************************************************** * FUNCTION init_function * * initialize the server instrumentation library. * Initialization Phase 1 * *********************************************************************/ static status_t init_function (const xmlChar *modname, const xmlChar *revision) { ... res = ncxmod_load_module(modname, revision, agt_get_savedevQ(), mod); if (res != NO_ERR) { return res; } ... }
After we load the module and have the module pointer, we can utilize it to locate top level objects in the module.
Alternatively, if the module already loaded and you want to locate the module in order to use it later to search for object templates you may use thefollowing API function:
... ncx_module_t *mod = ncx_find_module(modname, revision); if (ncmod == NULL) { res = ERR_NCX_DEF_NOT_FOUND; } ...