Browse Source

engine: platform: posix: use RTLD_NOW instead of lazy.

It actually was a misconception coming from old engine fork
We want to track unresolved symbols before library could be loaded

Also, disable "symbol not found" spam in FunctionFromName. Due to how
savefile mangling convert works and compatibility with GoldSrc saves,
this function is used to bruteforce possible symbol names.
pull/2/head
Alibek Omarov 2 years ago
parent
commit
5e1f189db3
  1. 11
      engine/platform/posix/lib_posix.c

11
engine/platform/posix/lib_posix.c

@ -102,7 +102,7 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d
// try to find by linker(LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, LD_32_LIBRARY_PATH and so on...) // try to find by linker(LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, LD_32_LIBRARY_PATH and so on...)
if( !pHandle ) if( !pHandle )
{ {
pHandle = dlopen( dllname, RTLD_LAZY ); pHandle = dlopen( dllname, RTLD_NOW );
if( pHandle ) if( pHandle )
return pHandle; return pHandle;
@ -139,7 +139,7 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d
else else
#endif #endif
{ {
if( !( hInst->hInstance = dlopen( hInst->fullPath, RTLD_LAZY ) ) ) if( !( hInst->hInstance = dlopen( hInst->fullPath, RTLD_NOW ) ) )
{ {
COM_PushLibraryError( dlerror() ); COM_PushLibraryError( dlerror() );
Mem_Free( hInst ); Mem_Free( hInst );
@ -188,12 +188,7 @@ void *COM_GetProcAddress( void *hInstance, const char *name )
void *COM_FunctionFromName( void *hInstance, const char *pName ) void *COM_FunctionFromName( void *hInstance, const char *pName )
{ {
void *function; return COM_GetProcAddress( hInstance, pName );
if( !( function = COM_GetProcAddress( hInstance, pName ) ) )
{
Con_Reportf( S_ERROR "FunctionFromName: Can't get symbol %s: %s\n", pName, dlerror());
}
return function;
} }
#ifdef XASH_DYNAMIC_DLADDR #ifdef XASH_DYNAMIC_DLADDR

Loading…
Cancel
Save