Add wxDynamicLibrary::GetModuleFromAddress().
Use dladdr() under Unix, if available, to provide the same functionality as we get from GetModuleHandleEx() under MSW and export it in a new public function. Closes #15248. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76114 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -280,5 +280,25 @@ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded()
|
||||
return dlls;
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
void* wxDynamicLibrary::GetModuleFromAddress(const void* addr, wxString* path)
|
||||
{
|
||||
#ifdef HAVE_DLADDR
|
||||
Dl_info di = { 0 };
|
||||
|
||||
if ( dladdr(addr, &di) == 0 )
|
||||
return NULL;
|
||||
|
||||
if ( path )
|
||||
*path = di.dli_fname;
|
||||
|
||||
return di.dli_fbase;
|
||||
#endif // HAVE_DLADDR
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#endif // wxUSE_DYNLIB_CLASS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user