]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dynlib.cpp
Some minors changes, like adding empty lines at end of files, to be able to compile...
[wxWidgets.git] / src / common / dynlib.cpp
index dd2cfa443e0711fe57dc771001a9632e3c16bb96..bd6cbe525016d3fb27c6efba51373282c39aa6ff 100644 (file)
@@ -23,9 +23,9 @@
 
 #include  "wx/wxprec.h"
 
-#ifdef    __BORLANDC__
-#   pragma hdrstop
-#endif  //__BORLANDC__
+#ifdef __BORLANDC__
+  #pragma hdrstop
+#endif
 
 #if wxUSE_DYNLIB_CLASS
 
@@ -40,7 +40,7 @@
 // ----------------------------------------------------------------------------
 
 #if defined(HAVE_DLOPEN)
-#   define wxDllOpen(lib)                dlopen(lib.fn_str(), RTLD_LAZY)
+#   define wxDllOpen(lib)                dlopen(lib.fn_str(), RTLD_NOW/*RTLD_LAZY*/)
 #   define wxDllGetSymbol(handle, name)  dlsym(handle, name.mb_str())
 #   define wxDllClose                    dlclose
 #elif defined(HAVE_SHL_LOAD)
@@ -172,6 +172,20 @@ void *wxLibrary::GetSymbol(const wxString& symbname)
 // wxDllLoader
 // ---------------------------------------------------------------------------
 
+/* static */
+wxDllType
+wxDllLoader::GetProgramHandle(void)
+{
+#ifdef __UNIX__
+    return dlopen(NULL, RTLD_NOW/*RTLD_LAZY*/);
+#else
+    wxFAIL_MSG(_("This method is not implemented under Windows"));
+
+    return 0;
+#endif   
+}
+
+
 /* static */
 wxDllType
 wxDllLoader::LoadLibrary(const wxString & lib_name, bool *success)
@@ -208,6 +222,14 @@ wxDllLoader::LoadLibrary(const wxString & lib_name, bool *success)
    return handle;
 }
 
+
+/* static */
+void
+wxDllLoader::UnloadLibrary(wxDllType handle)
+{
+   wxDllClose(handle);
+}
+
 /* static */
 void *
 wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name)
@@ -301,7 +323,7 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
 #endif
 
     bool success = FALSE;
-    wxDllType handle = wxDllLoader::LoadDll(lib_name, &success);
+    wxDllType handle = wxDllLoader::LoadLibrary(lib_name, &success);
     if(success)
     {
        lib = new wxLibrary(handle);