X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fdlopen.c;h=57a33292ed169aba5105e83069a0f3ccf5b67ade;hb=d8cfe464424b41bd986276e19427f0079778bf8f;hp=becef8173ef7964fa22e29f8dfdd52899cc05a97;hpb=e228433823b90127a217950433e31f0ef44df813;p=mesa.git diff --git a/src/mesa/main/dlopen.c b/src/mesa/main/dlopen.c index becef8173ef..57a33292ed1 100644 --- a/src/mesa/main/dlopen.c +++ b/src/mesa/main/dlopen.c @@ -28,13 +28,15 @@ */ -#include "glheader.h" -#include "imports.h" +#include "compiler.h" #include "dlopen.h" -#if defined(_GNU_SOURCE) && !defined(__MINGW32__) +#if defined(_GNU_SOURCE) && !defined(__MINGW32__) && !defined(__blrts) #include #endif +#if defined(_WIN32) +#include +#endif /** @@ -44,11 +46,13 @@ void * _mesa_dlopen(const char *libname, int flags) { -#if defined(_GNU_SOURCE) +#if defined(__blrts) + return NULL; +#elif defined(_GNU_SOURCE) flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */ return dlopen(libname, flags); #elif defined(__MINGW32__) - return LoadLibrary(libname); + return LoadLibraryA(libname); #else return NULL; #endif @@ -63,20 +67,27 @@ _mesa_dlopen(const char *libname, int flags) GenericFunc _mesa_dlsym(void *handle, const char *fname) { -#if defined(__DJGPP__) + union { + void *v; + GenericFunc f; + } u; +#if defined(__blrts) + u.v = NULL; +#elif defined(__DJGPP__) /* need '_' prefix on symbol names */ char fname2[1000]; fname2[0] = '_'; - _mesa_strncpy(fname2 + 1, fname, 998); + strncpy(fname2 + 1, fname, 998); fname2[999] = 0; - return (GenericFunc) dlsym(handle, fname2); + u.v = dlsym(handle, fname2); #elif defined(_GNU_SOURCE) - return (GenericFunc) dlsym(handle, fname); + u.v = dlsym(handle, fname); #elif defined(__MINGW32__) - return (GenericFunc) GetProcAddress(handle, fname); + u.v = (void *) GetProcAddress(handle, fname); #else - return (GenericFunc) NULL; + u.v = NULL; #endif + return u.f; } @@ -86,7 +97,9 @@ _mesa_dlsym(void *handle, const char *fname) void _mesa_dlclose(void *handle) { -#if defined(_GNU_SOURCE) +#if defined(__blrts) + (void) handle; +#elif defined(_GNU_SOURCE) dlclose(handle); #elif defined(__MINGW32__) FreeLibrary(handle);