[cairo] Problems with gl surface backend on W32

LRN lrn1986 at gmail.com
Wed Apr 3 13:04:35 PDT 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aside from the fact that it just doesn't compile OOTB with mingw+glew
(had make a few quick'n'dirty compatibility hacks (patches are
attached)), i've also found some strange things with calling
convention mismatch. A patch for that is attached separately.

That patch fixed immediate problem with wglGetProcAddress, but,
apparently, all functions that are loaded by that function also use
stdcall, and thus must be called appropriately, and their CC must be
known at compilation time.
I have no idea how to fix things on such a scale.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRXItSAAoJEOs4Jb6SI2Cw7m8H/jBU9JcyiohyyLdDZhasYrAW
/35IUnkVSOnT+lKy2p6bryalEQgaeP8EF8eb9vi85OSlJOjoeCIKOTzhrQ/E3MyT
2Z0I5z5FnyJLTWO09mMzUZGXDdxtJmyvGk3Hdjjs7c7gYra5cvwynn42DVAJoPBj
Lyc4UtGVOnmExsbtjM8d22hyO2miKEyBBwIhsfcp8mE62BaY5inORN7rxPi3oleJ
dleQp5t4M4rVu+M82vot3UBAbetQx/BSly3a1XA4djrCAFRbsBo226fmfU1sTPKY
ettcjK1ZDRF3UlOdBZKvdDQ0d9gT3lWG3sL5g5bNTidMLPlWEzQHzQnCNfdXfZM=
=+9lk
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mingw.compat.patches.tar.xz
Type: application/octet-stream
Size: 1892 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130404/679d51ee/attachment.obj>
-------------- next part --------------
--- cairo-1.12.14/src/cairo-wgl-context.c.orig	2013-04-03 23:15:02 +0400
+++ cairo-1.12.14/src/cairo-wgl-context.c	2013-04-03 23:05:40 +0400
@@ -173,6 +173,16 @@
     return CAIRO_STATUS_SUCCESS;
 }
 
+/* This wrapper function has cdecl convention, just like all other
+ * get_proc_addr() variants.
+ * It calls wglGetProcAddress(), which uses stdcall convention.
+ */
+static cdecl void *
+cairo_cdecl_wglGetProcAddress (const char *procname)
+{
+  return wglGetProcAddress (procname);
+}
+
 cairo_device_t *
 cairo_wgl_device_create (HGLRC rc)
 {
@@ -200,7 +210,7 @@
     ctx->base.destroy = _wgl_destroy;
 
     status = _cairo_gl_dispatch_init (&ctx->base.dispatch,
-				      (cairo_gl_get_proc_addr_func_t) wglGetProcAddress);
+				      (cairo_gl_get_proc_addr_func_t) cairo_cdecl_wglGetProcAddress);
     if (unlikely (status)) {
 	free (ctx);
 	return _cairo_gl_context_create_in_error (status);


More information about the cairo mailing list