]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dynlib.cpp
fixed (?) mingw32/cygwin compilation
[wxWidgets.git] / src / common / dynlib.cpp
index cc41e9f693e7d6b9d3da0ba2ba6c4ad57381acf5..5976df793dcb2739d35a13f401fd2215bf84a36e 100644 (file)
 #  define wxDllGetSymbol(handle, modaddr)   DosQueryProcAddr(handle, 1L, NULL, (PFN*)modaddr)
 #  define wxDllClose(handle)                DosFreeModule(handle)
 #elif defined(HAVE_DLOPEN)
-#   define wxDllOpen(lib)                dlopen(lib.fn_str(), RTLD_NOW/*RTLD_LAZY*/)
-#   define wxDllGetSymbol(handle, name)  dlsym(handle, name)
+    // note about dlopen() flags: we use RTLD_NOW to have more Windows-like
+    // behaviour (Win won't let you load a library with missing symbols) and
+    // RTLD_GLOBAL because it is needed sometimes and probably doesn't hurt
+    // otherwise. On True64-Unix RTLD_GLOBAL is not allowed and on VMS the
+    // second argument on dlopen is ignored.
+#ifdef __VMS
+# define wxDllOpen(lib)                dlopen(lib.fn_str(), 0 )
+#elif defined( __osf__ )
+# define wxDllOpen(lib)                dlopen(lib.fn_str(), RTLD_LAZY )
+#else
+# define wxDllOpen(lib)                dlopen(lib.fn_str(), RTLD_LAZY | RTLD_GLOBAL)
+#endif
+#define wxDllGetSymbol(handle, name)  dlsym(handle, name)
 #   define wxDllClose                    dlclose
 #elif defined(HAVE_SHL_LOAD)
 #   define wxDllOpen(lib)                shl_load(lib.fn_str(), BIND_DEFERRED, 0)
-#   define wxDllClose      shl_unload
+#   define wxDllClose                    shl_unload
 
     static inline void *wxDllGetSymbol(shl_t handle, const wxString& name)
     {
@@ -102,7 +113,6 @@ static wxString ConstructLibraryName(const wxString& basename)
     return fullname;
 }
 
-
 // ---------------------------------------------------------------------------
 // wxLibrary (one instance per dynamic library)
 // ---------------------------------------------------------------------------