Fix shared library loading for x86_64

Library handles are "void *" on posix.
This commit is contained in:
dhewg 2011-12-01 10:40:40 +01:00
parent 2c26f0c52a
commit 0c84e4bff3
9 changed files with 26 additions and 26 deletions

View file

@ -226,9 +226,9 @@ const char * idSysLocal::GetCallStackStr( const address_t *callStack, const int
const char * idSysLocal::GetCallStackCurStr( int depth ) { return ""; }
void idSysLocal::ShutdownSymbols( void ) {}
int idSysLocal::DLL_Load( const char *dllName ) { return 0; }
void * idSysLocal::DLL_GetProcAddress( int dllHandle, const char *procName ) { return NULL; }
void idSysLocal::DLL_Unload( int dllHandle ) { }
uintptr_t idSysLocal::DLL_Load( const char *dllName ) { return 0; }
void * idSysLocal::DLL_GetProcAddress( uintptr_t dllHandle, const char *procName ) { return NULL; }
void idSysLocal::DLL_Unload( uintptr_t dllHandle ) { }
void idSysLocal::DLL_GetFileName( const char *baseName, char *dllName, int maxLength ) { }
sysEvent_t idSysLocal::GenerateMouseButtonEvent( int button, bool down ) { sysEvent_t ev; memset( &ev, 0, sizeof( ev ) ); return ev; }

View file

@ -42,7 +42,7 @@ static idStr Maya_Error;
static exporterInterface_t Maya_ConvertModel = NULL;
static exporterShutdown_t Maya_Shutdown = NULL;
static int importDLL = 0;
static uintptr_t importDLL = 0;
bool idModelExport::initialized = false;

View file

@ -193,7 +193,7 @@ private:
idStrList warningList;
idStrList errorList;
int gameDLL;
uintptr_t gameDLL;
idLangDict languageDict;

View file

@ -42,7 +42,7 @@ static idStr Maya_Error;
static exporterInterface_t Maya_ConvertModel = NULL;
static exporterShutdown_t Maya_Shutdown = NULL;
static int importDLL = 0;
static uintptr_t importDLL = 0;
bool idModelExport::initialized = false;

View file

@ -387,12 +387,12 @@ Sys_DLL_Load
TODO: OSX - use the native API instead? NSModule
=================
*/
int Sys_DLL_Load( const char *path ) {
uintptr_t Sys_DLL_Load( const char *path ) {
void *handle = dlopen( path, RTLD_NOW );
if ( !handle ) {
Sys_Printf( "dlopen '%s' failed: %s\n", path, dlerror() );
}
return (int)handle;
return (uintptr_t)handle;
}
/*
@ -400,7 +400,7 @@ int Sys_DLL_Load( const char *path ) {
Sys_DLL_GetProcAddress
=================
*/
void* Sys_DLL_GetProcAddress( int handle, const char *sym ) {
void* Sys_DLL_GetProcAddress( uintptr_t handle, const char *sym ) {
const char *error;
void *ret = dlsym( (void *)handle, sym );
if ((error = dlerror()) != NULL) {
@ -414,7 +414,7 @@ void* Sys_DLL_GetProcAddress( int handle, const char *sym ) {
Sys_DLL_Unload
=================
*/
void Sys_DLL_Unload( int handle ) {
void Sys_DLL_Unload( uintptr_t handle ) {
dlclose( (void *)handle );
}

View file

@ -108,15 +108,15 @@ void idSysLocal::ShutdownSymbols( void ) {
Sys_ShutdownSymbols();
}
int idSysLocal::DLL_Load( const char *dllName ) {
uintptr_t idSysLocal::DLL_Load( const char *dllName ) {
return Sys_DLL_Load( dllName );
}
void *idSysLocal::DLL_GetProcAddress( int dllHandle, const char *procName ) {
void *idSysLocal::DLL_GetProcAddress( uintptr_t dllHandle, const char *procName ) {
return Sys_DLL_GetProcAddress( dllHandle, procName );
}
void idSysLocal::DLL_Unload( int dllHandle ) {
void idSysLocal::DLL_Unload( uintptr_t dllHandle ) {
Sys_DLL_Unload( dllHandle );
}

View file

@ -61,9 +61,9 @@ public:
virtual bool LockMemory( void *ptr, int bytes );
virtual bool UnlockMemory( void *ptr, int bytes );
virtual int DLL_Load( const char *dllName );
virtual void * DLL_GetProcAddress( int dllHandle, const char *procName );
virtual void DLL_Unload( int dllHandle );
virtual uintptr_t DLL_Load( const char *dllName );
virtual void * DLL_GetProcAddress( uintptr_t dllHandle, const char *procName );
virtual void DLL_Unload( uintptr_t dllHandle );
virtual void DLL_GetFileName( const char *baseName, char *dllName, int maxLength );
virtual sysEvent_t GenerateMouseButtonEvent( int button, bool down );

View file

@ -331,9 +331,9 @@ const char * Sys_GetCallStackCurAddressStr( int depth );
void Sys_ShutdownSymbols( void );
// DLL loading, the path should be a fully qualified OS path to the DLL file to be loaded
int Sys_DLL_Load( const char *dllName );
void * Sys_DLL_GetProcAddress( int dllHandle, const char *procName );
void Sys_DLL_Unload( int dllHandle );
uintptr_t Sys_DLL_Load( const char *dllName );
void * Sys_DLL_GetProcAddress( uintptr_t dllHandle, const char *procName );
void Sys_DLL_Unload( uintptr_t dllHandle );
// event generation
void Sys_GenerateEvents( void );
@ -563,9 +563,9 @@ public:
virtual const char * GetCallStackCurStr( int depth ) = 0;
virtual void ShutdownSymbols( void ) = 0;
virtual int DLL_Load( const char *dllName ) = 0;
virtual void * DLL_GetProcAddress( int dllHandle, const char *procName ) = 0;
virtual void DLL_Unload( int dllHandle ) = 0;
virtual uintptr_t DLL_Load( const char *dllName ) = 0;
virtual void * DLL_GetProcAddress( uintptr_t dllHandle, const char *procName ) = 0;
virtual void DLL_Unload( uintptr_t dllHandle ) = 0;
virtual void DLL_GetFileName( const char *baseName, char *dllName, int maxLength ) = 0;
virtual sysEvent_t GenerateMouseButtonEvent( int button, bool down ) = 0;

View file

@ -655,7 +655,7 @@ DLL Loading
Sys_DLL_Load
=====================
*/
int Sys_DLL_Load( const char *dllName ) {
uintptr_t Sys_DLL_Load( const char *dllName ) {
HINSTANCE libHandle;
libHandle = LoadLibrary( dllName );
if ( libHandle ) {
@ -668,7 +668,7 @@ int Sys_DLL_Load( const char *dllName ) {
return 0;
}
}
return (int)libHandle;
return (uintptr_t)libHandle;
}
/*
@ -676,7 +676,7 @@ int Sys_DLL_Load( const char *dllName ) {
Sys_DLL_GetProcAddress
=====================
*/
void *Sys_DLL_GetProcAddress( int dllHandle, const char *procName ) {
void *Sys_DLL_GetProcAddress( uintptr_t dllHandle, const char *procName ) {
return GetProcAddress( (HINSTANCE)dllHandle, procName );
}
@ -685,7 +685,7 @@ void *Sys_DLL_GetProcAddress( int dllHandle, const char *procName ) {
Sys_DLL_Unload
=====================
*/
void Sys_DLL_Unload( int dllHandle ) {
void Sys_DLL_Unload( uintptr_t dllHandle ) {
if ( !dllHandle ) {
return;
}