Dlopen better implementation management (Version 2)

This commit is contained in:
niansa
2023-05-31 21:37:25 +02:00
committed by Adam Treat
parent 92407438c8
commit a3d08cdcd5
7 changed files with 80 additions and 47 deletions

View File

@@ -44,11 +44,11 @@ public:
}
template<typename T>
T* get(const std::string& fname) {
T* get(const std::string& fname) const {
auto fres = reinterpret_cast<T*>(dlsym(chandle, fname.c_str()));
return (dlerror()==NULL)?fres:nullptr;
}
auto get_fnc(const std::string& fname) {
auto get_fnc(const std::string& fname) const {
return get<void*(...)>(fname);
}
};
@@ -90,10 +90,10 @@ public:
}
template<typename T>
T* get(const std::string& fname) {
T* get(const std::string& fname) const {
return reinterpret_cast<T*>(GetProcAddress(chandle, fname.c_str()));
}
auto get_fnc(const std::string& fname) {
auto get_fnc(const std::string& fname) const {
return get<void*(...)>(fname);
}
};