0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-06 10:38:37 +02:00

ircd::mods: Slightly more graceful handling of boost::dll's noexcept issue.

This commit is contained in:
Jason Volk 2017-03-20 21:25:07 -07:00
parent 6a0e5e4de5
commit ae9b37939e

View file

@ -587,10 +587,35 @@ std::map<std::string, mod *> mod::loaded;
ircd::mods::mod::mod(const filesystem::path &path,
const load_mode::type &type)
try
:handle
:handle{[&path, &type]
{
path, type
}
const auto ours([]
{
log.critical("std::terminate() called during the static construction of a module.");
if(std::current_exception()) try
{
std::rethrow_exception(std::current_exception());
}
catch(const std::exception &e)
{
log.error("%s", e.what());
}
});
const auto theirs
{
std::get_terminate()
};
const scope reset{[&theirs]
{
std::set_terminate(theirs);
}};
std::set_terminate(ours);
return boost::dll::shared_library{path, type};
}()}
,header
{
&handle.get<mapi::header>(mapi::header_symbol_name)