fix windows with casting

This commit is contained in:
Green Sky 2023-05-23 13:23:07 +02:00
parent 9f34a13d44
commit 115bfb228d
No known key found for this signature in database

View File

@ -26,7 +26,7 @@
void* Plugin::loadSymbol(const char* s_name) { void* Plugin::loadSymbol(const char* s_name) {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
return GetProcAddress(_dl, s_name); return reinterpret_cast<void*>(GetProcAddress(static_cast<HMODULE>(_dl), s_name));
#else #else
return dlsym(_dl, s_name); return dlsym(_dl, s_name);
#endif #endif
@ -35,9 +35,9 @@ void* Plugin::loadSymbol(const char* s_name) {
// loads lib and gets name (and version) // loads lib and gets name (and version)
Plugin::Plugin(const char* path) { Plugin::Plugin(const char* path) {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
_dl = (void*)LoadLibraryA(path); _dl = static_cast<void*>(LoadLibraryA(path));
#else #else
_dl = (void*)dlopen(path, RTLD_NOW /*| RTLD_LOCAL*/); _dl = static_cast<void*>(dlopen(path, RTLD_NOW /*| RTLD_LOCAL*/));
#endif #endif
if (!_dl) { if (!_dl) {
@ -97,7 +97,7 @@ Plugin::Plugin(Plugin&& other) {
Plugin::~Plugin(void) { Plugin::~Plugin(void) {
if (_dl != nullptr) { if (_dl != nullptr) {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
FreeLibrary(_dl); FreeLibrary(static_cast<HMODULE>(_dl));
#else #else
dlclose(_dl); dlclose(_dl);
#endif #endif