Use dlsym() to avoid referencing __dri2DriverInitScreen.
authorKristian Høgsberg <krh@redhat.com>
Tue, 26 Feb 2008 01:02:25 +0000 (20:02 -0500)
committerKristian Høgsberg <krh@redhat.com>
Tue, 26 Feb 2008 01:02:25 +0000 (20:02 -0500)
Sort-of a stop-gap workaround.  There are a couple of nicer ways to
do this that doesn't require dlfcn.h, but they're more invasive.

src/mesa/drivers/dri/common/dri_util.c

index 9928a0f0319af9efc3c68b67a1a4e9fd9cd08c0e..ce8ae5e299419c3e1d08be3f3404bda179bfd65b 100644 (file)
@@ -883,6 +883,11 @@ __DRI2_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
     static const __DRIextension *emptyExtensionList[] = { NULL };
     dri_interface = interface;
     unsigned int *p;
+    __GLcontextModes *(*initScreen)(__DRIscreen *psc);
+
+    initScreen = dlsym(NULL, __dri2DriverInitScreen);
+    if (initScreen == NULL)
+        return NULL;
 
     psp = _mesa_malloc(sizeof(*psp));
     if (!psp)
@@ -931,7 +936,7 @@ __DRI2_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
     psc->createNewDrawable = driCreateNewDrawable;
     psc->createNewContext  = driCreateNewContext;
 
-    *driver_modes = __dri2DriverInitScreen(psp);
+    *driver_modes = initScreen(psp);
     if (*driver_modes == NULL) {
        drmBOUnmap(psp->fd, &psp->dri2.sareaBO);
        drmBOUnreference(psp->fd, &psp->dri2.sareaBO);