From 3190dcfb79057cea4cdbe86a6354341b9974ee75 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sat, 2 May 2020 11:08:53 +0800 Subject: (presumably) Ported the visualization renderer to Windows. --- visualization/renderer/qmpvisrendercore.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/visualization/renderer/qmpvisrendercore.cpp b/visualization/renderer/qmpvisrendercore.cpp index f8044f5..c4d1079 100644 --- a/visualization/renderer/qmpvisrendercore.cpp +++ b/visualization/renderer/qmpvisrendercore.cpp @@ -6,7 +6,14 @@ #include #include +#ifdef _WIN32 +#include +#define dlopen(a,b) LoadLibraryW(a) +#define dlsym GetProcAddress +#define dlclose FreeLibrary +#else #include +#endif #include #include @@ -26,7 +33,24 @@ qmpVisRenderCore::qmpVisRenderCore(QCommandLineParser *_clp):QObject(nullptr),cl bool qmpVisRenderCore::loadVisualizationLibrary() { - mp=dlopen("libvisualization.so",RTLD_LAZY); +#ifdef _WIN32 + std::vector libpath={ + QCoreApplication::applicationDirPath().toStdWString()+L"/plugins/libvisualization.dll" + L"libvisualization.dll", + L"../libvisualization.dll"//for debugging only...? + }; +#else + std::vector libpath={ + QCoreApplication::applicationDirPath().toStdString()+"/plugins/libvisualization.so" + QT_STRINGIFY(INSTALL_PREFIX)+std::string("/lib/qmidiplayer/libvisualization.so"), + "../libvisualization.so"//for debugging only + }; +#endif + for(auto&l:libpath) + { + mp=dlopen(l.c_str(),RTLD_LAZY); + if(mp)break; + } if(!mp) { fprintf(stderr,"failed to load the visualization module!\n"); -- cgit v1.2.3