diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index b9ad8ac18..afb6039f3 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -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(); } }