2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-25 19:30:08 +01:00

platform/android: enable dynamic dladdr, fix build

This commit is contained in:
mittorn 2020-07-08 08:45:24 +07:00
parent a5e3a74e93
commit bef873e1f8
3 changed files with 22 additions and 2 deletions

View File

@ -69,6 +69,7 @@ SETUP BACKENDS DEFINITIONS
#endif // XASH_MESSAGEBOX
#define XASH_USE_EVDEV
#define XASH_DYNAMIC_DLADDR
#elif XASH_LINUX
// we are building for Linux without SDL2, can draw only to framebuffer yet
#ifndef XASH_VIDEO

View File

@ -243,6 +243,24 @@ void Sys_RestoreCrashHandler( void )
#include <signal.h>
#include <sys/mman.h>
#ifdef XASH_DYNAMIC_DLADDR
static int d_dladdr( void *sym, Dl_info *info )
{
static int (*dladdr_real) ( void *sym, Dl_info *info );
if( !dladdr_real )
dladdr_real = dlsym( (void*)(size_t)(-1), "dladdr" );
memset( info, 0, sizeof( *info ) );
if( !dladdr_real )
return -1;
return dladdr_real( sym, info );
}
#define dladdr d_dladdr
#endif
int printframe( char *buf, int len, int i, void *addr )
{
Dl_info dlinfo;

View File

@ -198,20 +198,21 @@ void *COM_FunctionFromName( void *hInstance, const char *pName )
}
#ifdef XASH_DYNAMIC_DLADDR
int d_dladdr( void *sym, Dl_info *info )
static int d_dladdr( void *sym, Dl_info *info )
{
static int (*dladdr_real) ( void *sym, Dl_info *info );
if( !dladdr_real )
dladdr_real = dlsym( (void*)(size_t)(-1), "dladdr" );
Q_memset( info, 0, sizeof( *info ) );
memset( info, 0, sizeof( *info ) );
if( !dladdr_real )
return -1;
return dladdr_real( sym, info );
}
#define dladdr d_dladdr
#endif
const char *COM_NameForFunction( void *hInstance, void *function )