Skip to content

Commit

Permalink
[dylib] Allow to specify a list of dylibs to load instead of just one
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Jan 20, 2024
1 parent 3b470e1 commit 09f85e4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/ossia/detail/dylib_loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ class dylib_loader
}
}

explicit dylib_loader(std::vector<std::string_view> sos)
{
if(sos.empty())
throw std::runtime_error("No shared object specified");

for(const auto so : sos)
{
impl = dlopen(so.data(), RTLD_LAZY | RTLD_LOCAL | RTLD_NODELETE);
if(impl)
return;
}

throw std::runtime_error(fmt::format("{}: not found. ", sos[0]));
}

dylib_loader(const dylib_loader&) noexcept = delete;
dylib_loader& operator=(const dylib_loader&) noexcept = delete;
dylib_loader(dylib_loader&& other) noexcept
Expand Down

0 comments on commit 09f85e4

Please sign in to comment.