From: Karsten Ballüder Date: Tue, 29 Jun 1999 17:04:57 +0000 (+0000) Subject: Added code to look up main program symbols - unix only. PLEASE FIX FOR MSW. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0868079c33c321955e08e34515a60cf25dee6ca6 Added code to look up main program symbols - unix only. PLEASE FIX FOR MSW. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2931 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/dynlib.h b/include/wx/dynlib.h index 90cfe6fa80..860088f690 100644 --- a/include/wx/dynlib.h +++ b/include/wx/dynlib.h @@ -76,6 +76,9 @@ class wxDllLoader @return A handle to the loaded DLL. Use success parameter to test if it is valid. */ static wxDllType LoadLibrary(const wxString & libname, bool *success); + /** This function returns a valid handle for the main program + itself. */ + static wxDllType GetProgramHandle(void); /** This function resolves a symbol in a loaded DLL, such as a variable or function name. @param dllHandle Handle of the DLL, as returned by LoadDll(). diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index d7b654faa1..0a161789d8 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -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,19 @@ void *wxLibrary::GetSymbol(const wxString& symbname) // wxDllLoader // --------------------------------------------------------------------------- +/* static */ +wxDllType +wxDllLoader::GetProgramHandle(void) +{ +#ifdef __WXGTK__ + return dlopen(NULL, RTLD_NOW/*RTLD_LAZY*/); +#else +#pragma warning "Not implemented, please fix!" + return 0; +#endif +} + + /* static */ wxDllType wxDllLoader::LoadLibrary(const wxString & lib_name, bool *success)