Skip to content

Commit

Permalink
platform/android/dlsym-weak: do not call LoadLibrary to find server l…
Browse files Browse the repository at this point in the history
…ibrary instance
  • Loading branch information
mittorn committed Dec 16, 2023
1 parent a83c48a commit 2eb3629
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions engine/platform/android/dlsym-weak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,15 @@ static Elf_Sym* dlsym_handle_lookup( soinfo* si, const char* name )
return soinfo_elf_lookup( si, elfhash( name ), name );
}

extern "C" void *ANDROID_LoadLibrary( const char *dllname );
#include "lib_android.h"

static int dladdr_fallback( const void *addr, Dl_info *info )
{
static soinfo *server_info;
Elf_Sym *sym;

if( !server_info )
server_info = ( soinfo* )ANDROID_LoadLibrary( "server" );
server_info = ( soinfo* )ANDROID_GetServerLibrary();
if( !server_info )
return 0;
//__android_log_print( ANDROID_LOG_ERROR, "dladdr_fb", "%p %p\n", addr, server_info );
Expand Down
6 changes: 6 additions & 0 deletions engine/platform/android/lib_android.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ GNU General Public License for more details.
#include "platform/android/lib_android.h"
#include "platform/android/dlsym-weak.h" // Android < 5.0

void *Android_GetServerLibrary( void )
{
return svgame.hInstance;
}


void *ANDROID_LoadLibrary( const char *dllname )
{
char path[MAX_SYSPATH];
Expand Down
1 change: 1 addition & 0 deletions engine/platform/android/lib_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ GNU General Public License for more details.
#define Platform_POSIX_LoadLibrary( x ) ANDROID_LoadLibrary(( x ))
#define Platform_POSIX_GetProcAddress( x, y ) ANDROID_GetProcAddress(( x ), ( y ))

void *Android_GetServerLibrary( void );
void *ANDROID_LoadLibrary( const char *dllname );
void *ANDROID_GetProcAddress( void *hInstance, const char *name );

Expand Down

0 comments on commit 2eb3629

Please sign in to comment.