pub fn require_module(
table: &mut modulestab,
modname: &str,
features: Option<&[String]>,
silent: i32,
feat_pat: bool,
) -> i32Expand description
Port of require_module() from Src/module.c:2344. — C decl require_module(const char *module, Feature_enables features, int silent).
C body c:2342-2360:
mod_export int
require_module(const char *module, Feature_enables features, int silent)
{
Module m = NULL;
int ret = 0;
queue_signals();
m = find_module(module, FINDMOD_ALIASP, &module);
if (!m || !m->u.handle ||
(m->node.flags & MOD_UNLOAD))
ret = load_module(module, features, silent);
else
ret = do_module_features(m, features, 0);
unqueue_signals();
return ret;
}Two branches: when the module isn’t loaded yet (or is mid-unload),
route through load_module which runs the full setup → features →
boot lifecycle. When it’s already loaded, skip to
do_module_features to just enable the requested per-feature
surface — much cheaper.
Static-link analog of m->u.handle is MOD_INIT_B (boot ran):
once boot_module has fired, the module is “loaded” in zshrs’s
non-dlopen world.
WARNING: param names don’t match C — Rust=(table, modname, features, silent) vs C=(module, features, silent)