Handle dlsym() failures in chainloaders better

If these ever fail (because the function names change, not that that
should happen anytime soon) then you'll now get the expected logging
output instead of it just printing an assertion failure to the terminal.
This commit is contained in:
Robbert van der Helm
2022-04-21 14:21:26 +02:00
parent 958007b56d
commit 89378e8862
4 changed files with 35 additions and 2 deletions
+20
View File
@@ -104,3 +104,23 @@ void* find_plugin_library(const std::string& name) {
return handle;
}
void log_failing_dlsym(const std::string& library_name,
const char* function_name) {
const fs::path this_plugin_path = get_this_file_location();
Logger logger = Logger::create_exception_logger();
logger.log("");
logger.log("Could not find '" + std::string(function_name) + "' in '" +
library_name + "'");
logger.log("");
logger.log("Try rerunning 'yabridgectl sync'.");
logger.log("");
logger.log("Source: '" + this_plugin_path.string() + "'");
logger.log("");
send_notification("Could not find '" + std::string(function_name) +
"' in '" + library_name + "'",
"Try rerunning 'yabridgectl sync'.", this_plugin_path);
}