X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4dc2c3bbc5bc04b6239e14a7ec4e3ddc400a00bc..cc985face55ed02c310860afefc8e6d656fb849d:/src/common/dynlib.cpp diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index dd2cfa443e..bd6cbe5250 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -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);