Bug 89208

Summary: Link errors when building cairo 1.12.18 on Windows.
Product: cairo Reporter: peavo
Component: win32 backendAssignee: cairo-bugs mailing list <cairo-bugs>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: peavo
Version: unspecified   
Hardware: Other   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch

Description peavo 2015-02-18 15:12:09 UTC
The symbols glActiveTexture and glBlendFuncSeparate are not found.
Comment 1 peavo 2015-02-18 15:19:08 UTC
diff --git a/src/cairo-wgl-context.c b/src/cairo-wgl-context.c
index 4872374..5a1bad6 100644
--- a/src/cairo-wgl-context.c
+++ b/src/cairo-wgl-context.c
@@ -259,3 +259,22 @@ cairo_gl_surface_create_for_dc (cairo_device_t     *device,
     return &surface->base.base;
 }
+
+static PFNGLACTIVETEXTUREARBPROC _glActiveTextureARB = NULL;
+static PFNGLBLENDFUNCSEPARATEPROC _glBlendFuncSeparate = NULL;
+
+void InitWGLStuff()
+{
+    _glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress((LPCSTR)"glActiveTextureARB");
+    _glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)wglGetProcAddress((LPCSTR)"glBlendFuncSeparate");
+}
+
+GLAPI void APIENTRY glActiveTexture(GLenum texture)
+{
+    (*_glActiveTextureARB)(texture);
+}
+
+GLAPI void APIENTRY glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
+{
+    (*_glBlendFuncSeparate)(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
+}
diff --git a/src/win32/cairo-win32-system.c b/src/win32/cairo-win32-system.c
index 8785530..a2c01d0 100644
--- a/src/win32/cairo-win32-system.c
+++ b/src/win32/cairo-win32-system.c
@@ -61,6 +61,8 @@

 #include <windows.h>

+void InitWGLStuff();
+
 /* declare to avoid "no previous prototype for 'DllMain'" warning */
 BOOL WINAPI
 DllMain (HINSTANCE hinstDLL,
@@ -75,6 +77,7 @@ DllMain (HINSTANCE hinstDLL,
     switch (fdwReason) {
         case DLL_PROCESS_ATTACH:
             CAIRO_MUTEX_INITIALIZE ();
+            InitWGLStuff();
             break;

         case DLL_PROCESS_DETACH:
Comment 2 peavo 2015-02-18 15:20:32 UTC
Posted a diff which fixes the link errors.
Comment 3 peavo 2015-02-18 16:16:20 UTC
Created attachment 113624 [details]
Patch

Added proposed fix.
Comment 4 GitLab Migration User 2018-08-25 13:50:57 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/229.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.