mirror of
https://github.com/NixOS/nix
synced 2025-06-27 12:41:15 +02:00
initPlugins: run nix_plugin_entry() on dlopen'd plugins
Only when it exists.
This commit is contained in:
parent
713f10aeaa
commit
dc0f7d8f96
1 changed files with 6 additions and 0 deletions
|
@ -346,6 +346,12 @@ void initPlugins()
|
||||||
dlopen(file.c_str(), RTLD_LAZY | RTLD_LOCAL);
|
dlopen(file.c_str(), RTLD_LAZY | RTLD_LOCAL);
|
||||||
if (!handle)
|
if (!handle)
|
||||||
throw Error("could not dynamically open plugin file '%s': %s", file, dlerror());
|
throw Error("could not dynamically open plugin file '%s': %s", file, dlerror());
|
||||||
|
|
||||||
|
/* Older plugins use a statically initialized object to run their code.
|
||||||
|
Newer plugins can also export nix_plugin_entry() */
|
||||||
|
void (*nix_plugin_entry)() = (void (*)())dlsym(handle, "nix_plugin_entry");
|
||||||
|
if (nix_plugin_entry)
|
||||||
|
nix_plugin_entry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue