added linux support

This commit is contained in:
itsmattkc
2019-01-20 23:05:59 +11:00
parent d5eab3673c
commit 3882288238
7 changed files with 426 additions and 356 deletions
+25
View File
@@ -0,0 +1,25 @@
#include "crossplatformlib.h"
#include <QDebug>
void *LibLoad(const QString &filename) {
#ifdef _WIN32
LPCWSTR dll_fn_w = reinterpret_cast<const wchar_t*>(filename.utf16());
return LoadLibrary(dll_fn_w);
#elif __linux__
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;
#endif
}
QStringList LibFilter() {
#ifdef _WIN32
return QStringList("*.dll");
#elif __linux__
return QStringList("*.so");
#elif __APPLE__
return QStringList("*.dylib");
#endif
}