Index: trunk/src/VBox/Additions/common/crOpenGL/Makefile.kmk
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/Makefile.kmk	(revision 25247)
+++ trunk/src/VBox/Additions/common/crOpenGL/Makefile.kmk	(revision 25248)
@@ -55,6 +55,6 @@
  # Only Solaris right now needs C stubs because I can't figure out how to
  # generate the GOT based relocation ASM yet.
- ifeq ($(KBUILD_TARGET),solaris)
-  ifdef VBoxOGL_FAKEDRI
+ ifdef VBoxOGL_FAKEDRI
+  if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),solaris.x86 solaris.amd64 linux.x86)
    VBOX_OGL_GLX_USE_CSTUBS = 1
   endif
@@ -87,10 +87,14 @@
  VBoxOGL_DEFS     += VBOX_NO_NATIVEGL
 endif
+
 ifdef VBoxOGL_DRI
  VBoxOGL_DEFS          += VBOXOGL_DRI IN_DRI_DRIVER
 else ifdef VBoxOGL_FAKEDRI
  VBoxOGL_DEFS          += VBOXOGL_FAKEDRI
- VBoxOGL_DEFS.solaris  += VBOX_OGL_GLX_USE_CSTUBS
-endif
+ ifdef VBOX_OGL_GLX_USE_CSTUBS
+  VBoxOGL_DEFS         += VBOX_OGL_GLX_USE_CSTUBS
+ endif
+endif
+
 ifeq ($(KBUILD_TARGET),win)
 #fixme?, INTERMEDIATES.win ain't working
@@ -132,14 +136,16 @@
   VBoxOGL_SOURCES += \
  	fakedri_drv.c
-  VBoxOGL_SOURCES.linux += \
- 	$(VBOX_PATH_CROGL_GENFILES)/linux_glxapi_exports.asm \
- 	$(VBOX_PATH_CROGL_GENFILES)/linux_exports_dri.asm
   ifndef VBOX_OGL_GLX_USE_CSTUBS
    VBoxOGL_SOURCES.solaris += \
  	$(VBOX_PATH_CROGL_GENFILES)/solaris_glxapi_exports.asm \
  	$(VBOX_PATH_CROGL_GENFILES)/solaris_exports_dri.asm
+  VBoxOGL_SOURCES.linux += \
+ 	$(VBOX_PATH_CROGL_GENFILES)/linux_glxapi_exports.asm \
+ 	$(VBOX_PATH_CROGL_GENFILES)/linux_exports_dri.asm
   else
    VBoxOGL_SOURCES.solaris += \
   	$(VBOX_PATH_CROGL_GENFILES)/solaris_exports.c  
+  VBoxOGL_SOURCES.linux += \
+  	$(VBOX_PATH_CROGL_GENFILES)/linux_exports.c  
   endif
  else
@@ -295,8 +301,14 @@
   endif
  else
-  # @todo linux if required
   ifeq ($(KBUILD_TARGET),solaris)
 $(VBOX_PATH_CROGL_GENFILES)/solaris_exports.c: \
 		$(PATH_SUB_CURRENT)/SunOS_exports.py \
+		$(VBOX_CROGL_API_FILES) $(PATH_SUB_CURRENT)/entrypoints.py \
+		| $$(dir $$@)
+	$(call MSG_GENERATE,python,$@,$<)
+	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
+  else
+$(VBOX_PATH_CROGL_GENFILES)/linux_exports.c: \
+		$(PATH_SUB_CURRENT)/Linux_exports.py \
 		$(VBOX_CROGL_API_FILES) $(PATH_SUB_CURRENT)/entrypoints.py \
 		| $$(dir $$@)
Index: trunk/src/VBox/Additions/common/crOpenGL/fakedri_drv.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/fakedri_drv.c	(revision 25247)
+++ trunk/src/VBox/Additions/common/crOpenGL/fakedri_drv.c	(revision 25248)
@@ -140,12 +140,9 @@
     void *alPatch;
     void *pMesaEntry;
-#ifdef RT_ARCH_AMD64
     char patch[5];
     void *shift;
-#endif
 
 #ifndef VBOX_NO_MESA_PATCH_REPORTS
-    crDebug("");
-    crDebug("vboxPatchMesaExport: %s", psFuncName);
+    crDebug("\nvboxPatchMesaExport: %s", psFuncName);
 #endif
 
@@ -172,5 +169,5 @@
 
         rv = dladdr1(pStart, &dlip1, (void**)&sym1, RTLD_DL_SYMENT);
-        if (!rv || !sym)
+        if (!rv || !sym1)
         {
             crError("Failed to get size for %p", pStart);
@@ -188,8 +185,9 @@
 #endif
 
+#ifndef VBOX_OGL_GLX_USE_CSTUBS
     if (sym->st_size<(pEnd-pStart))
-    {
-#ifdef RT_ARCH_AMD64
-        /* Try to insert 5 bytes jmpq to our stub code */
+#endif
+    {
+        /* Try to insert 5 bytes jmp/jmpq to our stub code */
 
     	if (5>(pEnd-pStart))
@@ -201,12 +199,19 @@
         shift = (void*)((intptr_t)pStart-((intptr_t)dlip.dli_saddr+5));
 # ifndef VBOX_NO_MESA_PATCH_REPORTS
-        crDebug("Size is small, inserting jmpq with shift %p instead", shift);
+        crDebug("Inserting jmp[q] with shift %p instead", shift);
 # endif
 
-        if ( ((((long)shift)&0x00000000) != 0) 
-             && ((((long)shift)&0x00000000) != 0xFFFFFFFF00000000))
         {
-            crDebug("Can't patch offset is too big.(%s)", psFuncName);
-            return;
+#ifdef RT_ARCH_AMD64
+            int64_t offset = (intptr_t)shift;            
+#else
+            int64_t offset = (int64_t)((intptr_t)pStart)-((int64_t)((intptr_t)dlip.dli_saddr)+5);
+#endif
+            if ( (RT_HIDWORD(offset) != 0) && (RT_HIDWORD(offset) != 0xFFFFFFFF)
+                 && (((int32_t)offset > INT32_MAX) || ((int32_t)offset < INT32_MIN)))
+            {
+                crDebug("Can't patch offset is too big.(%s)", psFuncName);
+                return;
+            }
         }
 
@@ -222,8 +227,4 @@
         pStart = &patch[0];
         pEnd = &patch[5];
-#else
-        crDebug("Can't patch size too small.(%s)", psFuncName);
-        return;
-#endif //ifdef RT_ARCH_AMD64
     }
 
Index: trunk/src/VBox/Additions/common/crOpenGL/glx_c_exports.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/glx_c_exports.c	(revision 25247)
+++ trunk/src/VBox/Additions/common/crOpenGL/glx_c_exports.c	(revision 25248)
@@ -27,25 +27,25 @@
 
 #ifdef VBOXOGL_FAKEDRI
-/*void VBOXGLXENTRYTAG(glXGetDriverConfig)(const char *driverName)
+/*DECLEXPORT(void) VBOXGLXENTRYTAG(glXGetDriverConfig)(const char *driverName)
 {
     return glxim.GetDriverConfig(driverName);
 }*/
 
-void VBOXGLXENTRYTAG(glXFreeMemoryMESA)(Display *dpy, int scrn, void *pointer)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXFreeMemoryMESA)(Display *dpy, int scrn, void *pointer)
 {
     return glxim.FreeMemoryMESA(dpy, scrn, pointer);
 }
 
-GLXContext VBOXGLXENTRYTAG(glXImportContextEXT)(Display *dpy, GLXContextID contextID)
+DECLEXPORT(GLXContext) VBOXGLXENTRYTAG(glXImportContextEXT)(Display *dpy, GLXContextID contextID)
 {
     return glxim.ImportContextEXT(dpy, contextID);
 }
 
-GLXContextID VBOXGLXENTRYTAG(glXGetContextIDEXT)(const GLXContext ctx)
+DECLEXPORT(GLXContextID) VBOXGLXENTRYTAG(glXGetContextIDEXT)(const GLXContext ctx)
 {
     return glxim.GetContextIDEXT(ctx);
 }
 
-Bool VBOXGLXENTRYTAG(glXMakeCurrentReadSGI)(Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
+DECLEXPORT(Bool) VBOXGLXENTRYTAG(glXMakeCurrentReadSGI)(Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
 {
     return glxim.MakeCurrentReadSGI(display, draw, read, ctx);
@@ -59,10 +59,10 @@
 
 
-Display * VBOXGLXENTRYTAG(glXGetCurrentDisplayEXT)(void)
+DECLEXPORT(Display*) VBOXGLXENTRYTAG(glXGetCurrentDisplayEXT)(void)
 {
     return glxim.GetCurrentDisplayEXT();
 }
 
-void VBOXGLXENTRYTAG(glXFreeContextEXT)(Display *dpy, GLXContext ctx)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXFreeContextEXT)(Display *dpy, GLXContext ctx)
 {
     return glxim.FreeContextEXT(dpy, ctx);
@@ -70,10 +70,10 @@
 
 /*Mesa insternal*/
-int VBOXGLXENTRYTAG(glXQueryContextInfoEXT)(Display *dpy, GLXContext ctx)
+DECLEXPORT(int) VBOXGLXENTRYTAG(glXQueryContextInfoEXT)(Display *dpy, GLXContext ctx)
 {
     return glxim.QueryContextInfoEXT(dpy, ctx);
 }
 
-void * VBOXGLXENTRYTAG(glXAllocateMemoryMESA)(Display *dpy, int scrn,
+DECLEXPORT(void *) VBOXGLXENTRYTAG(glXAllocateMemoryMESA)(Display *dpy, int scrn,
                                                        size_t size, float readFreq,
                                                        float writeFreq, float priority)
@@ -82,5 +82,5 @@
 }
 
-GLuint VBOXGLXENTRYTAG(glXGetMemoryOffsetMESA)(Display *dpy, int scrn, const void *pointer )
+DECLEXPORT(GLuint) VBOXGLXENTRYTAG(glXGetMemoryOffsetMESA)(Display *dpy, int scrn, const void *pointer )
 {
     return glxim.GetMemoryOffsetMESA(dpy, scrn, pointer);
@@ -88,5 +88,5 @@
 
 
-GLXPixmap VBOXGLXENTRYTAG(glXCreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap)
+DECLEXPORT(GLXPixmap) VBOXGLXENTRYTAG(glXCreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap)
 {
     return glxim.CreateGLXPixmapMESA(dpy, visual, pixmap, cmap);
@@ -95,5 +95,5 @@
 
 /*Common glX functions*/
-void VBOXGLXENTRYTAG(glXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, unsigned long mask)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, unsigned long mask)
 {
     return glxim.CopyContext(dpy, src, dst, mask);
@@ -101,30 +101,30 @@
 
 
-void VBOXGLXENTRYTAG(glXUseXFont)(Font font, int first, int count, int listBase)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXUseXFont)(Font font, int first, int count, int listBase)
 {
     return glxim.UseXFont(font, first, count, listBase);
 }
 
-CR_GLXFuncPtr VBOXGLXENTRYTAG(glXGetProcAddress)(const GLubyte *name)
+DECLEXPORT(CR_GLXFuncPtr) VBOXGLXENTRYTAG(glXGetProcAddress)(const GLubyte *name)
 {
     return glxim.GetProcAddress(name);
 }
 
-Bool VBOXGLXENTRYTAG(glXQueryExtension)(Display *dpy, int *errorBase, int *eventBase)
+DECLEXPORT(Bool) VBOXGLXENTRYTAG(glXQueryExtension)(Display *dpy, int *errorBase, int *eventBase)
 {
     return glxim.QueryExtension(dpy, errorBase, eventBase);
 }
 
-Bool VBOXGLXENTRYTAG(glXIsDirect)(Display *dpy, GLXContext ctx)
+DECLEXPORT(Bool) VBOXGLXENTRYTAG(glXIsDirect)(Display *dpy, GLXContext ctx)
 {
     return glxim.IsDirect(dpy, ctx);
 }
 
-GLXPixmap VBOXGLXENTRYTAG(glXCreateGLXPixmap)(Display *dpy, XVisualInfo *vis, Pixmap pixmap)
+DECLEXPORT(GLXPixmap) VBOXGLXENTRYTAG(glXCreateGLXPixmap)(Display *dpy, XVisualInfo *vis, Pixmap pixmap)
 {
     return glxim.CreateGLXPixmap(dpy, vis, pixmap);
 }
 
-void VBOXGLXENTRYTAG(glXSwapBuffers)(Display *dpy, GLXDrawable drawable)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXSwapBuffers)(Display *dpy, GLXDrawable drawable)
 {
     return glxim.SwapBuffers(dpy, drawable);
@@ -132,80 +132,80 @@
 
 
-GLXDrawable VBOXGLXENTRYTAG(glXGetCurrentDrawable)(void)
+DECLEXPORT(GLXDrawable) VBOXGLXENTRYTAG(glXGetCurrentDrawable)(void)
 {
     return glxim.GetCurrentDrawable();
 }
 
-void VBOXGLXENTRYTAG(glXWaitGL)(void)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXWaitGL)(void)
 {
     return glxim.WaitGL();
 }
 
-Display * VBOXGLXENTRYTAG(glXGetCurrentDisplay)(void)
+DECLEXPORT(Display *) VBOXGLXENTRYTAG(glXGetCurrentDisplay)(void)
 {
     return glxim.GetCurrentDisplay();
 }
 
-const char * VBOXGLXENTRYTAG(glXQueryServerString)(Display *dpy, int screen, int name)
+DECLEXPORT(const char *) VBOXGLXENTRYTAG(glXQueryServerString)(Display *dpy, int screen, int name)
 {
     return glxim.QueryServerString(dpy, screen, name);
 }
 
-GLXContext VBOXGLXENTRYTAG(glXCreateContext)(Display *dpy, XVisualInfo *vis, GLXContext share, Bool direct)
+DECLEXPORT(GLXContext) VBOXGLXENTRYTAG(glXCreateContext)(Display *dpy, XVisualInfo *vis, GLXContext share, Bool direct)
 {
     return glxim.CreateContext(dpy, vis, share, direct);
 }
 
-int VBOXGLXENTRYTAG(glXGetConfig)(Display *dpy, XVisualInfo *vis, int attrib, int *value)
+DECLEXPORT(int) VBOXGLXENTRYTAG(glXGetConfig)(Display *dpy, XVisualInfo *vis, int attrib, int *value)
 {
     return glxim.GetConfig(dpy, vis, attrib, value);
 }
 
-void VBOXGLXENTRYTAG(glXWaitX)(void)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXWaitX)(void)
 {
     return glxim.WaitX();
 }
 
-GLXContext VBOXGLXENTRYTAG(glXGetCurrentContext)(void)
+DECLEXPORT(GLXContext) VBOXGLXENTRYTAG(glXGetCurrentContext)(void)
 {
     return glxim.GetCurrentContext();
 }
 
-const char * VBOXGLXENTRYTAG(glXGetClientString)(Display *dpy, int name)
+DECLEXPORT(const char *) VBOXGLXENTRYTAG(glXGetClientString)(Display *dpy, int name)
 {
     return glxim.GetClientString(dpy, name);
 }
 
-Bool VBOXGLXENTRYTAG(glXMakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx)
+DECLEXPORT(Bool) VBOXGLXENTRYTAG(glXMakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx)
 {
     return glxim.MakeCurrent(dpy, drawable, ctx);
 }
 
-void VBOXGLXENTRYTAG(glXDestroyContext)(Display *dpy, GLXContext ctx)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXDestroyContext)(Display *dpy, GLXContext ctx)
 {
     return glxim.DestroyContext(dpy, ctx);
 }
 
-CR_GLXFuncPtr VBOXGLXENTRYTAG(glXGetProcAddressARB)(const GLubyte *name)
+DECLEXPORT(CR_GLXFuncPtr) VBOXGLXENTRYTAG(glXGetProcAddressARB)(const GLubyte *name)
 {
     return glxim.GetProcAddressARB(name);
 }
 
-void VBOXGLXENTRYTAG(glXDestroyGLXPixmap)(Display *dpy, GLXPixmap pix)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXDestroyGLXPixmap)(Display *dpy, GLXPixmap pix)
 {
     return glxim.DestroyGLXPixmap(dpy, pix);
 }
 
-Bool VBOXGLXENTRYTAG(glXQueryVersion)(Display *dpy, int *major, int *minor)
+DECLEXPORT(Bool) VBOXGLXENTRYTAG(glXQueryVersion)(Display *dpy, int *major, int *minor)
 {
     return glxim.QueryVersion(dpy, major, minor);
 }
 
-XVisualInfo * VBOXGLXENTRYTAG(glXChooseVisual)(Display *dpy, int screen, int *attribList)
+DECLEXPORT(XVisualInfo *) VBOXGLXENTRYTAG(glXChooseVisual)(Display *dpy, int screen, int *attribList)
 {
     return glxim.ChooseVisual(dpy, screen, attribList);
 }
 
-const char * VBOXGLXENTRYTAG(glXQueryExtensionsString)(Display *dpy, int screen)
+DECLEXPORT(const char *) VBOXGLXENTRYTAG(glXQueryExtensionsString)(Display *dpy, int screen)
 {
     return glxim.QueryExtensionsString(dpy, screen);
@@ -213,5 +213,5 @@
 
 #if GLX_EXTRAS
-GLXPbufferSGIX VBOXGLXENTRYTAG(glXCreateGLXPbufferSGIX)
+DECLEXPORT(GLXPbufferSGIX) VBOXGLXENTRYTAG(glXCreateGLXPbufferSGIX)
 (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list)
 {
@@ -219,5 +219,5 @@
 }
 
-int VBOXGLXENTRYTAG(glXQueryGLXPbufferSGIX)
+DECLEXPORT(int) VBOXGLXENTRYTAG(glXQueryGLXPbufferSGIX)
 (Display *dpy, GLXPbuffer pbuf, int attribute, unsigned int *value)
 {
@@ -225,5 +225,5 @@
 }
 
-GLXFBConfigSGIX * VBOXGLXENTRYTAG(glXChooseFBConfigSGIX)
+DECLEXPORT(GLXFBConfigSGIX *) VBOXGLXENTRYTAG(glXChooseFBConfigSGIX)
 (Display *dpy, int screen, int *attrib_list, int *nelements)
 {
@@ -231,30 +231,30 @@
 }
 
-void VBOXGLXENTRYTAG(glXDestroyGLXPbufferSGIX)(Display *dpy, GLXPbuffer pbuf)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXDestroyGLXPbufferSGIX)(Display *dpy, GLXPbuffer pbuf)
 {
     return glxim.DestroyGLXPbufferSGIX(dpy, pbuf);
 }
 
-void VBOXGLXENTRYTAG(glXSelectEventSGIX)(Display *dpy, GLXDrawable drawable, unsigned long mask)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXSelectEventSGIX)(Display *dpy, GLXDrawable drawable, unsigned long mask)
 {
     return glxim.SelectEventSGIX(dpy, drawable, mask);
 }
 
-void VBOXGLXENTRYTAG(glXGetSelectedEventSGIX)(Display *dpy, GLXDrawable drawable, unsigned long *mask)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXGetSelectedEventSGIX)(Display *dpy, GLXDrawable drawable, unsigned long *mask)
 {
     return glxim.GetSelectedEventSGIX(dpy, drawable, mask);
 }
 
-GLXFBConfigSGIX VBOXGLXENTRYTAG(glXGetFBConfigFromVisualSGIX)(Display *dpy, XVisualInfo *vis)
+DECLEXPORT(GLXFBConfigSGIX) VBOXGLXENTRYTAG(glXGetFBConfigFromVisualSGIX)(Display *dpy, XVisualInfo *vis)
 {
     return glxim.GetFBConfigFromVisualSGIX(dpy, vis);
 }
 
-XVisualInfo * VBOXGLXENTRYTAG(glXGetVisualFromFBConfigSGIX)(Display *dpy, GLXFBConfig config)
+DECLEXPORT(XVisualInfo *) VBOXGLXENTRYTAG(glXGetVisualFromFBConfigSGIX)(Display *dpy, GLXFBConfig config)
 {
     return glxim.GetVisualFromFBConfigSGIX(dpy, config);
 }
 
-GLXContext VBOXGLXENTRYTAG(glXCreateContextWithConfigSGIX)
+DECLEXPORT(GLXContext) VBOXGLXENTRYTAG(glXCreateContextWithConfigSGIX)
 (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct)
 {
@@ -262,10 +262,10 @@
 }
 
-GLXPixmap VBOXGLXENTRYTAG(glXCreateGLXPixmapWithConfigSGIX)(Display *dpy, GLXFBConfig config, Pixmap pixmap)
+DECLEXPORT(GLXPixmap) VBOXGLXENTRYTAG(glXCreateGLXPixmapWithConfigSGIX)(Display *dpy, GLXFBConfig config, Pixmap pixmap)
 {
     return glxim.CreateGLXPixmapWithConfigSGIX(dpy, config, pixmap);
 }
 
-int VBOXGLXENTRYTAG(glXGetFBConfigAttribSGIX)(Display *dpy, GLXFBConfig config, int attribute, int *value)
+DECLEXPORT(int) VBOXGLXENTRYTAG(glXGetFBConfigAttribSGIX)(Display *dpy, GLXFBConfig config, int attribute, int *value)
 {
     return glxim.GetFBConfigAttribSGIX(dpy, config, attribute, value);
@@ -276,20 +276,20 @@
  * GLX 1.3 functions
  */
-GLXFBConfig * VBOXGLXENTRYTAG(glXChooseFBConfig)(Display *dpy, int screen, ATTRIB_TYPE *attrib_list, int *nelements)
+DECLEXPORT(GLXFBConfig *) VBOXGLXENTRYTAG(glXChooseFBConfig)(Display *dpy, int screen, ATTRIB_TYPE *attrib_list, int *nelements)
 {
     return glxim.ChooseFBConfig(dpy, screen, attrib_list, nelements);
 }
 
-GLXPbuffer VBOXGLXENTRYTAG(glXCreatePbuffer)(Display *dpy, GLXFBConfig config, ATTRIB_TYPE *attrib_list)
+DECLEXPORT(GLXPbuffer) VBOXGLXENTRYTAG(glXCreatePbuffer)(Display *dpy, GLXFBConfig config, ATTRIB_TYPE *attrib_list)
 {
     return glxim.CreatePbuffer(dpy, config, attrib_list);
 }
 
-GLXPixmap VBOXGLXENTRYTAG(glXCreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const ATTRIB_TYPE *attrib_list)
+DECLEXPORT(GLXPixmap) VBOXGLXENTRYTAG(glXCreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const ATTRIB_TYPE *attrib_list)
 {
     return glxim.CreatePixmap(dpy, config, pixmap, attrib_list);
 }
 
-GLXWindow VBOXGLXENTRYTAG(glXCreateWindow)(Display *dpy, GLXFBConfig config, Window win, ATTRIB_TYPE *attrib_list)
+DECLEXPORT(GLXWindow) VBOXGLXENTRYTAG(glXCreateWindow)(Display *dpy, GLXFBConfig config, Window win, ATTRIB_TYPE *attrib_list)
 {
     return glxim.CreateWindow(dpy, config, win, attrib_list);
@@ -297,5 +297,5 @@
 
 
-GLXContext VBOXGLXENTRYTAG(glXCreateNewContext)
+DECLEXPORT(GLXContext) VBOXGLXENTRYTAG(glXCreateNewContext)
 (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct)
 {
@@ -303,60 +303,60 @@
 }
 
-void VBOXGLXENTRYTAG(glXDestroyPbuffer)(Display *dpy, GLXPbuffer pbuf)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXDestroyPbuffer)(Display *dpy, GLXPbuffer pbuf)
 {
     return glxim.DestroyPbuffer(dpy, pbuf);
 }
 
-void VBOXGLXENTRYTAG(glXDestroyPixmap)(Display *dpy, GLXPixmap pixmap)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXDestroyPixmap)(Display *dpy, GLXPixmap pixmap)
 {
     return glxim.DestroyPixmap(dpy, pixmap);
 }
 
-void VBOXGLXENTRYTAG(glXDestroyWindow)(Display *dpy, GLXWindow win)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXDestroyWindow)(Display *dpy, GLXWindow win)
 {
     return glxim.DestroyWindow(dpy, win);
 }
 
-GLXDrawable VBOXGLXENTRYTAG(glXGetCurrentReadDrawable)(void)
+DECLEXPORT(GLXDrawable) VBOXGLXENTRYTAG(glXGetCurrentReadDrawable)(void)
 {
     return glxim.GetCurrentReadDrawable();
 }
 
-int VBOXGLXENTRYTAG(glXGetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value)
+DECLEXPORT(int) VBOXGLXENTRYTAG(glXGetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value)
 {
     return glxim.GetFBConfigAttrib(dpy, config, attribute, value);
 }
 
-GLXFBConfig * VBOXGLXENTRYTAG(glXGetFBConfigs)(Display *dpy, int screen, int *nelements)
+DECLEXPORT(GLXFBConfig *) VBOXGLXENTRYTAG(glXGetFBConfigs)(Display *dpy, int screen, int *nelements)
 {
     return glxim.GetFBConfigs(dpy, screen, nelements);
 }
 
-void VBOXGLXENTRYTAG(glXGetSelectedEvent)(Display *dpy, GLXDrawable draw, unsigned long *event_mask)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXGetSelectedEvent)(Display *dpy, GLXDrawable draw, unsigned long *event_mask)
 {
     return glxim.GetSelectedEvent(dpy, draw, event_mask);
 }
 
-XVisualInfo * VBOXGLXENTRYTAG(glXGetVisualFromFBConfig)(Display *dpy, GLXFBConfig config)
+DECLEXPORT(XVisualInfo *) VBOXGLXENTRYTAG(glXGetVisualFromFBConfig)(Display *dpy, GLXFBConfig config)
 {
     return glxim.GetVisualFromFBConfig(dpy, config);
 }
 
-Bool VBOXGLXENTRYTAG(glXMakeContextCurrent)(Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
+DECLEXPORT(Bool) VBOXGLXENTRYTAG(glXMakeContextCurrent)(Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
 {
     return glxim.MakeContextCurrent(display, draw, read, ctx);
 }
 
-int VBOXGLXENTRYTAG(glXQueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value)
+DECLEXPORT(int) VBOXGLXENTRYTAG(glXQueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value)
 {
     return glxim.QueryContext(dpy, ctx, attribute, value);
 }
 
-void VBOXGLXENTRYTAG(glXQueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXQueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value)
 {
     return glxim.QueryDrawable(dpy, draw, attribute, value);
 }
 
-void VBOXGLXENTRYTAG(glXSelectEvent)(Display *dpy, GLXDrawable draw, unsigned long event_mask)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXSelectEvent)(Display *dpy, GLXDrawable draw, unsigned long event_mask)
 {
     return glxim.SelectEvent(dpy, draw, event_mask);
@@ -365,10 +365,10 @@
 /*
 #ifdef CR_EXT_texture_from_pixmap
-void VBOXGLXENTRYTAG(glXBindTexImageEXT)(Display *dpy, GLXDrawable draw, int buffer, const int *attrib_list)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXBindTexImageEXT)(Display *dpy, GLXDrawable draw, int buffer, const int *attrib_list)
 {
     return glxim.BindTexImageEXT(dpy, draw, buffer, attrib_list);
 }
 
-void VBOXGLXENTRYTAG(glXReleaseTexImageEXT)(Display *dpy, GLXDrawable draw, int buffer)
+DECLEXPORT(void) VBOXGLXENTRYTAG(glXReleaseTexImageEXT)(Display *dpy, GLXDrawable draw, int buffer)
 {
     return glxim.ReleaseTexImageEXT(dpy, draw, buffer);
