You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MangoHud/src/gl/real_dlsym.cpp

19 lines
491 B
C++

#include "real_dlsym.h"
#include <stdlib.h>
#include <dlfcn.h>
extern "C" void* __libc_dlsym( void* handle, const char* name );
void* real_dlsym( void* handle, const char* name )
{
static void *(*the_real_dlsym)( void*, const char* );
if (!the_real_dlsym) {
void* libdl = dlopen( "libdl.so", RTLD_NOW | RTLD_LOCAL );
the_real_dlsym = reinterpret_cast<decltype(the_real_dlsym)> (__libc_dlsym( libdl, "dlsym" ));
}
return the_real_dlsym( handle, name );
}