print error on loading failure

This commit is contained in:
Green Sky 2023-06-25 15:47:17 +02:00
parent 115bfb228d
commit 614f14eb0a
No known key found for this signature in database
1 changed files with 11 additions and 1 deletions

View File

@ -41,7 +41,17 @@ Plugin::Plugin(const char* path) {
#endif
if (!_dl) {
std::cerr << "PLG opening '" << path << "' failed\n";
std::cerr << "PLG opening '" << path << "' failed";
#if defined(_WIN32) || defined(_WIN64)
// TODO: windows error reporting
std::cerr << ": " << GetLastError() << ";
#else
const auto* error = dlerror();
if (error != nullptr) {
std::cerr << ": '" << error << "'";
}
#endif
std::cerr << "\n";
return;
}