|
|
|
@ -67,10 +67,6 @@ TODO
|
|
|
|
|
#include "connect.h"
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
|
#ifndef KGTK_DLSYM_VERSION
|
|
|
|
|
#define KGTK_DLSYM_VERSION "GLIBC_2.0"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define BLACKLIST_UNKNOWN_GTK_APPS 0
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -78,15 +74,10 @@ TODO
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* For SWT apps (e.g. eclipse) we need to override dlsym, but we can only do this if
|
|
|
|
|
* dlvsym is present in libdl. dlvsym is needed so that we can access the real dlsym
|
|
|
|
|
* as well as our fake dlsym
|
|
|
|
|
* For SWT apps (e.g. eclipse) we need to override dlsym.
|
|
|
|
|
*/
|
|
|
|
|
#ifdef HAVE_DLVSYM
|
|
|
|
|
extern void *_dl_sym(void *, const char *, void *);
|
|
|
|
|
static void * real_dlsym (void *handle, const char *name);
|
|
|
|
|
#else
|
|
|
|
|
#define real_dlsym(A, B) dlsym(A, B)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
@ -2241,41 +2232,38 @@ void * PR_FindFunctionSymbol(struct PR_LoadLibrary *lib, const char *raw_name)
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_DLVSYM
|
|
|
|
|
/* Overriding dlsym is required for SWT - which dlsym's the gtk_file_chooser functions! */
|
|
|
|
|
static void * real_dlsym(void *handle, const char *name)
|
|
|
|
|
{
|
|
|
|
|
static void * (*realFunction)() = NULL;
|
|
|
|
|
|
|
|
|
|
#ifdef KGTK_DEBUG_DLSYM
|
|
|
|
|
printf("KGTK::real_dlsym : %s\n", name);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!realFunction)
|
|
|
|
|
{
|
|
|
|
|
void *ldHandle=dlopen("libdl.so", RTLD_NOW);
|
|
|
|
|
static void * (*realFunction)() = NULL;
|
|
|
|
|
|
|
|
|
|
#ifdef KGTK_DEBUG_DLSYM
|
|
|
|
|
printf("KGTK::real_dlsym : %s\n", name);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if(ldHandle)
|
|
|
|
|
{
|
|
|
|
|
static const char * versions[]={KGTK_DLSYM_VERSION, "GLIBC_2.3", "GLIBC_2.2.5",
|
|
|
|
|
"GLIBC_2.2", "GLIBC_2.1", "GLIBC_2.0", NULL};
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for(i=0; versions[i] && !realFunction; ++i)
|
|
|
|
|
realFunction=dlvsym(ldHandle, "dlsym", versions[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return realFunction(handle, name);
|
|
|
|
|
printf("KGTK::real_dlsym : %s\n", name);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!realFunction)
|
|
|
|
|
{
|
|
|
|
|
// Get the real dlsym function
|
|
|
|
|
realFunction = _dl_sym(RTLD_NEXT, "dlsym", dlsym);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (realFunction)
|
|
|
|
|
return realFunction(handle, name);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("kgtk-qt3 gtk2 real_dlsymc() realFunction not found!!\n");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void * dlsym(void *handle, const char *name)
|
|
|
|
|
{
|
|
|
|
|
// Need this so _dl_sym will be able to find the next dlsym, i.e. the real dlsym!
|
|
|
|
|
if (!strcmp(name, "dlsym"))
|
|
|
|
|
{
|
|
|
|
|
return (void*)dlsym;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *rv=NULL;
|
|
|
|
|
|
|
|
|
|
#ifdef KGTK_DEBUG_DLSYM
|
|
|
|
@ -2294,4 +2282,3 @@ void * dlsym(void *handle, const char *name)
|
|
|
|
|
#endif
|
|
|
|
|
return rv;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|