some corrections on windows
This commit is contained in:
@@ -2,24 +2,24 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
void *LibLoad(const QString &filename) {
|
||||
ModulePtr LibLoad(const QString &filename) {
|
||||
#ifdef _WIN32
|
||||
LPCWSTR dll_fn_w = reinterpret_cast<const wchar_t*>(filename.utf16());
|
||||
return LoadLibrary(dll_fn_w);
|
||||
LPCWSTR dll_fn_w = reinterpret_cast<const wchar_t*>(filename.utf16());
|
||||
return LoadLibrary(dll_fn_w);
|
||||
#elif __linux__
|
||||
return dlopen(filename.toUtf8(), RTLD_LAZY);
|
||||
return dlopen(filename.toUtf8(), RTLD_LAZY);
|
||||
#else
|
||||
qWarning() << "Olive doesn't know how to open dynamic libraries on this platform, external libraries will not be functional";
|
||||
return nullptr;
|
||||
qWarning() << "Olive doesn't know how to open dynamic libraries on this platform, external libraries will not be functional";
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
QStringList LibFilter() {
|
||||
#ifdef _WIN32
|
||||
return QStringList("*.dll");
|
||||
return QStringList("*.dll");
|
||||
#elif __linux__
|
||||
return QStringList("*.so");
|
||||
return QStringList("*.so");
|
||||
#elif __APPLE__
|
||||
return QStringList("*.dylib");
|
||||
return QStringList("*.dylib");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
#include <QString>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#define LibAddress GetProcAddress
|
||||
#define CloseLib FreeModule
|
||||
#define ModulePtr HMODULE
|
||||
#include <Windows.h>
|
||||
#define LibAddress GetProcAddress
|
||||
#define LibClose FreeModule
|
||||
#define ModulePtr HMODULE
|
||||
#elif __linux__
|
||||
#include <dlfcn.h>
|
||||
#define LibAddress dlsym
|
||||
#define LibClose dlclose
|
||||
#define ModulePtr void*
|
||||
#include <dlfcn.h>
|
||||
#define LibAddress dlsym
|
||||
#define LibClose dlclose
|
||||
#define ModulePtr void*
|
||||
#endif
|
||||
|
||||
ModulePtr LibLoad(const QString& filename);
|
||||
|
||||
Reference in New Issue
Block a user