[Orxonox-commit 2810] r7513 - code/branches/ois_update/src/libraries/core

rgrieder at orxonox.net rgrieder at orxonox.net
Sat Oct 9 00:27:51 CEST 2010


Author: rgrieder
Date: 2010-10-09 00:27:50 +0200 (Sat, 09 Oct 2010)
New Revision: 7513

Modified:
   code/branches/ois_update/src/libraries/core/DynLib.cc
   code/branches/ois_update/src/libraries/core/DynLib.h
Log:
Updated DynLib class to the newest version in the OGRE trunk.
This should hopefully make it compile on OS X.

Modified: code/branches/ois_update/src/libraries/core/DynLib.cc
===================================================================
--- code/branches/ois_update/src/libraries/core/DynLib.cc	2010-10-08 07:23:29 UTC (rev 7512)
+++ code/branches/ois_update/src/libraries/core/DynLib.cc	2010-10-08 22:27:50 UTC (rev 7513)
@@ -41,12 +41,12 @@
 #  include <windows.h>
 #endif
 
-#ifdef ORXONOX_PLATFORM_LINUX
+#ifdef ORXONOX_PLATFORM_UNIX
 #  include <dlfcn.h>
 #endif
 
 #ifdef ORXONOX_PLATFORM_APPLE
-#  include <macPlugins.h>
+#   include <OSX/macUtils.h> // OGRE include
 #endif
 
 namespace orxonox
@@ -74,6 +74,15 @@
         // dlopen() does not add .so to the filename, like windows does for .dll
         if (name.substr(name.length() - 3, 3) != ".so")
            name += ".so";
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+        // dlopen() does not add .dylib to the filename, like windows does for .dll
+        if (name.substr(name.length() - 6, 6) != ".dylib")
+            name += ".dylib";
+#elif OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+        // Although LoadLibraryEx will add .dll itself when you only specify the library name,
+        // if you include a relative path then it does not. So, add it to be sure.
+        if (name.substr(name.length() - 4, 4) != ".dll")
+            name += ".dll";
 #endif
 
         m_hInst = (DYNLIB_HANDLE)DYNLIB_LOAD( name.c_str() );
@@ -126,10 +135,8 @@
         // Free the buffer.
         LocalFree( lpMsgBuf );
         return ret;
-#elif defined(ORXONOX_PLATFORM_LINUX)
+#elif defined(ORXONOX_PLATFORM_UNIX)
         return std::string(dlerror());
-#elif defined(ORXONOX_PLATFORM_APPLE)
-        return std::string(mac_errorBundle());
 #else
         return "";
 #endif

Modified: code/branches/ois_update/src/libraries/core/DynLib.h
===================================================================
--- code/branches/ois_update/src/libraries/core/DynLib.h	2010-10-08 07:23:29 UTC (rev 7512)
+++ code/branches/ois_update/src/libraries/core/DynLib.h	2010-10-08 22:27:50 UTC (rev 7513)
@@ -58,10 +58,10 @@
 #    define DYNLIB_UNLOAD( a ) dlclose( a )
 
 #elif defined(ORXONOX_PLATFORM_APPLE)
-#    define DYNLIB_HANDLE CFBundleRef
-#    define DYNLIB_LOAD( a ) Ogre::mac_loadExeBundle( a )
-#    define DYNLIB_GETSYM( a, b ) Ogre::mac_getBundleSym( a, b )
-#    define DYNLIB_UNLOAD( a ) Ogre::mac_unloadExeBundle( a )
+#    define DYNLIB_HANDLE void*
+#    define DYNLIB_LOAD( a ) Ogre::mac_loadDylib( a )
+#    define DYNLIB_GETSYM( a, b ) dlsym( a, b )
+#    define DYNLIB_UNLOAD( a ) dlclose( a )
 #endif
 
 namespace orxonox




More information about the Orxonox-commit mailing list