diff --git a/common/port.h b/common/port.h index 435de115..ae60122f 100644 --- a/common/port.h +++ b/common/port.h @@ -47,14 +47,8 @@ GNU General Public License for more details. #define O_BINARY 0 #define O_TEXT 0 #define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ) - #define LoadLibrary( x ) dlopen( x, RTLD_NOW ) - #define GetProcAddress( x, y ) dlsym( x, y ) - #define FreeLibrary( x ) dlclose( x ) #elif XASH_DOS4GW #define PATH_SPLITTER "\\" - #define LoadLibrary( x ) (0) - #define GetProcAddress( x, y ) (0) - #define FreeLibrary( x ) (0) #endif typedef void* HANDLE; diff --git a/engine/common/system.c b/engine/common/system.c index 6916fdd1..c41854e8 100644 --- a/engine/common/system.c +++ b/engine/common/system.c @@ -34,6 +34,8 @@ GNU General Public License for more details. #include "menu_int.h" // _UPDATE_PAGE macro +#include "library.h" + qboolean error_on_exit = false; // arg for exit(); #define DEBUG_BREAK @@ -272,7 +274,8 @@ qboolean Sys_LoadLibrary( dll_info_t *dll ) *func->func = NULL; } - if( !dll->link ) dll->link = LoadLibrary ( dll->name ); // environment pathes + if( !dll->link ) + dll->link = COM_LoadLibrary( dll->name, false, true ); // environment pathes // no DLL found if( !dll->link ) @@ -307,7 +310,7 @@ void* Sys_GetProcAddress( dll_info_t *dll, const char* name ) if( !dll || !dll->link ) // invalid desc return NULL; - return (void *)GetProcAddress( dll->link, name ); + return (void *)COM_GetProcAddress( dll->link, name ); } qboolean Sys_FreeLibrary( dll_info_t *dll ) @@ -324,7 +327,7 @@ qboolean Sys_FreeLibrary( dll_info_t *dll ) } else Con_Reportf( "Sys_FreeLibrary: Unloading %s\n", dll->name ); - FreeLibrary( dll->link ); + COM_FreeLibrary( dll->link ); dll->link = NULL; return true; diff --git a/game_launch/game.cpp b/game_launch/game.cpp index 347f1973..5ebac7e8 100644 --- a/game_launch/game.cpp +++ b/game_launch/game.cpp @@ -23,6 +23,9 @@ GNU General Public License for more details. #if XASH_POSIX #define XASHLIB "libxash." OS_LIB_EXT +#define LoadLibrary( x ) dlopen( x, RTLD_NOW ) +#define GetProcAddress( x, y ) dlsym( x, y ) +#define FreeLibrary( x ) dlclose( x ) #include // execve #elif XASH_WIN32 #define XASHLIB "xash.dll" @@ -46,7 +49,7 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; #endif #if XASH_WIN32 || XASH_POSIX -#define USE_EXECVE_FOR_CHANGE_GAME 1 +#define USE_EXECVE_FOR_CHANGE_GAME 0 #else #define USE_EXECVE_FOR_CHANGE_GAME 0 #endif