1
0

fix: update dll loader

This commit is contained in:
2025-11-27 21:52:40 +08:00
parent 9af21b514a
commit b6d4269eeb
2 changed files with 14 additions and 10 deletions

View File

@@ -13,8 +13,7 @@ namespace Basalt::Presenter {
#else
m_Handle = dlopen(filename.data(), RTLD_LAZY);
#endif
if (!m_Handle)
throw std::runtime_error("can not load given dynamic library.");
if (!m_Handle) throw std::runtime_error("Can not load given dynamic library.");
}
DllLoader::~DllLoader() {
@@ -27,4 +26,13 @@ namespace Basalt::Presenter {
}
}
void *DllLoader::GetFunctionPointer(const char *name) {
if (!m_Handle) throw std::runtime_error("Can not fetch function pointer on not loaded dynamic library.");
#if defined(BASALT_OS_WINDOWS)
return (void *) GetProcAddress(m_Handle, name);
#else
return (void *) dlsym(m_Handle, name);
#endif
}
} // namespace Basalt::Presenter