mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 00:08:07 +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);
|
||||
if (!handle)
|
||||
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…
Reference in a new issue