Skip to content

Instantly share code, notes, and snippets.

@Icenowy
Created January 4, 2017 14:29
Show Gist options
  • Save Icenowy/090f9e825c0a8046f1ce16547b81d46c to your computer and use it in GitHub Desktop.
Save Icenowy/090f9e825c0a8046f1ce16547b81d46c to your computer and use it in GitHub Desktop.
#include <dlfcn.h>
#define NULL ((void *)0)
static void * libmali = NULL;
static void *(*maliEglGetProcAddress)(char *) = NULL;
void *eglGetProcAddress(char *name)
{
void *tmp;
if (!libmali)
libmali = dlopen("libMali.so", RTLD_LAZY);
if (!libmali)
return NULL;
if (!maliEglGetProcAddress)
maliEglGetProcAddress = dlsym(libmali, "eglGetProcAddress");
if (!maliEglGetProcAddress)
return NULL;
tmp = maliEglGetProcAddress(name);
if (tmp)
return tmp;
else
return dlsym(libmali, name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment