[Pixman] Windows XP delay-loaded dll patch

Alex Christensen alex.christensen at flexsim.com
Wed Dec 11 16:11:59 PST 2013


My coworker Anthony and I have been working on the WinCairo port of WebKit
which includes pixman.  We were having it crash when delay loading the dlls
on Windows XP because of improper usage of __declspec(thread).  We are
using the MinGW code with Visual Studio.  I'm not familiar with pixman
coding style, but here's something similar to our fix.  The windows.h stuff
is a little hacky, but the important part is the removal of the
__declspec(thread).

http://msdn.microsoft.com/en-us/library/yx1x886y.aspx
https://github.com/bfulgham/WinCairoRequirements

There are probably not many people using pixman on Windows XP with delay
loaded dlls, but I think a fix similar to this ought to be upstreamed:

diff --git a/pixman-compiler.h b/pixman-compiler.h
--- a/pixman-compiler.h
+++ b/pixman-compiler.h
@@ -118,6 +118,6 @@
 #   define PIXMAN_GET_THREAD_LOCAL(name) \
     (&name)

-#elif defined(__MINGW32__)
+#elif defined(__MINGW32__) || defined(_MSC_VER)

 #   define _NO_W32_PSEUDO_MODIFIERS
@@ -122,3 +122,5 @@

 #   define _NO_W32_PSEUDO_MODIFIERS
+
+#if !defined(_MSC_VER)
 #   include <windows.h>
@@ -124,4 +126,5 @@
 #   include <windows.h>
+#endif

 #   define PIXMAN_DEFINE_THREAD_LOCAL(type, name) \
     static volatile int tls_ ## name ## _initialized = 0; \
@@ -171,13 +174,6 @@
 #   define PIXMAN_GET_THREAD_LOCAL(name) \
     tls_ ## name ## _get ()

-#elif defined(_MSC_VER)
-
-#   define PIXMAN_DEFINE_THREAD_LOCAL(type, name) \
-    static __declspec(thread) type name
-#   define PIXMAN_GET_THREAD_LOCAL(name) \
-    (&name)
-
 #elif defined(HAVE_PTHREADS)

 #include <pthread.h>
diff --git a/pixman-implementation.c b/pixman-implementation.c
--- a/pixman-implementation.c
+++ b/pixman-implementation.c
@@ -63,6 +63,10 @@
     } cache [N_CACHED_FAST_PATHS];
 } cache_t;

+#if defined(_MSC_VER)
+#   include <windows.h>
+#endif
+
 PIXMAN_DEFINE_THREAD_LOCAL (cache_t, fast_path_cache);

 static void


-- 



Alex Christensen

FlexSim Software Products, Inc.

*1577 North Technology Way | Building A | Suite 2300 | Orem, Utah 84097*

*Voice: 801-224-6914 | Fax: 801-224-6984*

*Email:* alexc at flexsim.com <kimw at flexsim.com>

*URL:* www.flexsim.com



----------------------------------------------------------------------------------------

This message may contain confidential information, and is intended

only for the use of the individual(s) to whom it is addressed.
----------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20131211/8cb3017e/attachment.html>


More information about the Pixman mailing list