mirror of
https://github.com/matrix-construct/construct
synced 2024-10-08 00:28:55 +02:00
ircd::mods: Slightly more graceful handling of boost::dll's noexcept issue.
This commit is contained in:
parent
6a0e5e4de5
commit
ae9b37939e
1 changed files with 28 additions and 3 deletions
31
ircd/mods.cc
31
ircd/mods.cc
|
@ -587,10 +587,35 @@ std::map<std::string, mod *> mod::loaded;
|
||||||
ircd::mods::mod::mod(const filesystem::path &path,
|
ircd::mods::mod::mod(const filesystem::path &path,
|
||||||
const load_mode::type &type)
|
const load_mode::type &type)
|
||||||
try
|
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
|
,header
|
||||||
{
|
{
|
||||||
&handle.get<mapi::header>(mapi::header_symbol_name)
|
&handle.get<mapi::header>(mapi::header_symbol_name)
|
||||||
|
|
Loading…
Reference in a new issue