dynamically load sdl_net information so we don't have to link it
authorkoda
Mon, 08 Jul 2013 01:34:40 +0200
changeset 9327 02caf698a8f1
parent 9325 2d686849eead
child 9329 b825fa990e1c
dynamically load sdl_net information so we don't have to link it
QTfrontend/ui/widget/about.cpp
--- a/QTfrontend/ui/widget/about.cpp	Mon Jul 08 00:55:37 2013 +0200
+++ b/QTfrontend/ui/widget/about.cpp	Mon Jul 08 01:34:40 2013 +0200
@@ -39,6 +39,15 @@
 }
 #endif
 
+
+#if defined(Q_OS_WINDOWS)
+#define sopath(x) x ".dll"
+#elif defined(Q_OS_MAC)
+#define sopath(x) "@executable_path/../Frameworks/" x ".framework/" x
+#else
+#define sopath(x) x //TODO
+#endif
+
 #include "about.h"
 
 About::About(QWidget * parent) :
@@ -100,6 +109,20 @@
         .arg(MIX_MINOR_VERSION)
         .arg(MIX_PATCHLEVEL));
 
+    void *sdlnet_handle = SDL_LoadObject(sopath("SDL_net"));
+    if (sdlnet_handle != NULL) {
+        SDL_version *(*sdlnet_ver_get)(void) = NULL;
+        sdlnet_ver_get = (SDL_version *(*)(void)) SDL_LoadFunction(sdlnet_handle, "SDLNet_Linked_Version");
+        if (sdlnet_ver_get != NULL) {
+            SDL_version *sdlnet_ver = sdlnet_ver_get();
+            libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL_net</a> version: %1.%2.%3<br>")
+                .arg(sdlnet_ver->major)
+                .arg(sdlnet_ver->minor)
+                .arg(sdlnet_ver->patch));
+        }
+        SDL_UnloadObject(sdlnet_handle);
+    }
+
     libinfo.append(QString("<a href=\"http://qt-project.org/\">Qt</a> version: %1<br>").arg(QT_VERSION_STR));
 
 #ifdef VIDEOREC