New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a dynamic loader for plugins #56

sh00s opened this Issue Nov 12, 2018 · 0 comments


None yet
1 participant
Copy link

sh00s commented Nov 12, 2018

Currently the only way to load plugins is to build them as a static library, export the logdevice_plugin() symbol and link them to the binary that uses the logdevice library. StaticPluginLoader then picks them up:

namespace facebook { namespace logdevice {
PluginVector StaticPluginLoader::getPlugins() {
const std::vector<std::string> symbol_names{
// legacy names for plugins - new plugins shouldn't use these
PluginVector res;
for (const auto& symbol : symbol_names) {
void* ptr = dlsym(RTLD_DEFAULT, symbol.c_str());
if (ptr == nullptr) {
auto fnptr = reinterpret_cast<Plugin* (*)()>(ptr);
std::unique_ptr<Plugin> plugin_ptr(fnptr());
return res;

This is inconvenient, as this requires a rebuild of the binary every time something in the plugin changes. In addition to that, a dynamic plugin loader should be developed. It should pick up .so files from a certain folder, and then load all the plugins exported by those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment