<div dir="ltr">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).<div>
<br></div><div><a href="http://msdn.microsoft.com/en-us/library/yx1x886y.aspx">http://msdn.microsoft.com/en-us/library/yx1x886y.aspx</a></div><div><a href="https://github.com/bfulgham/WinCairoRequirements">https://github.com/bfulgham/WinCairoRequirements</a></div>
<div><br></div><div>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:<br><div><br></div><div><div>diff --git a/pixman-compiler.h b/pixman-compiler.h</div>
<div>--- a/pixman-compiler.h</div><div>+++ b/pixman-compiler.h</div><div>@@ -118,6 +118,6 @@</div><div> #   define PIXMAN_GET_THREAD_LOCAL(name)<span class="" style="white-space:pre">                             </span>\</div><div>     (&name)</div>
<div> </div><div>-#elif defined(__MINGW32__)</div><div>+#elif defined(__MINGW32__) || defined(_MSC_VER)</div><div> </div><div> #   define _NO_W32_PSEUDO_MODIFIERS</div><div>@@ -122,3 +122,5 @@</div><div> </div><div> #   define _NO_W32_PSEUDO_MODIFIERS</div>
<div>+</div><div>+#if !defined(_MSC_VER)</div><div> #   include <windows.h></div><div>@@ -124,4 +126,5 @@</div><div> #   include <windows.h></div><div>+#endif</div><div> </div><div> #   define PIXMAN_DEFINE_THREAD_LOCAL(type, name)<span class="" style="white-space:pre">                  </span>\</div>
<div>     static volatile int tls_ ## name ## _initialized = 0;<span class="" style="white-space:pre">          </span>\</div><div>@@ -171,13 +174,6 @@</div><div> #   define PIXMAN_GET_THREAD_LOCAL(name)<span class="" style="white-space:pre">                              </span>\</div>
<div>     tls_ ## name ## _get ()</div><div> </div><div>-#elif defined(_MSC_VER)</div><div>-</div><div>-#   define PIXMAN_DEFINE_THREAD_LOCAL(type, name)<span class="" style="white-space:pre">                        </span>\</div><div>-    static __declspec(thread) type name</div>
<div>-#   define PIXMAN_GET_THREAD_LOCAL(name)<span class="" style="white-space:pre">                           </span>\</div><div>-    (&name)</div><div>-</div><div> #elif defined(HAVE_PTHREADS)</div><div> </div><div> #include <pthread.h></div>
<div>diff --git a/pixman-implementation.c b/pixman-implementation.c</div><div>--- a/pixman-implementation.c</div><div>+++ b/pixman-implementation.c</div><div>@@ -63,6 +63,10 @@</div><div>     } cache [N_CACHED_FAST_PATHS];</div>
<div> } cache_t;</div><div> </div><div>+#if defined(_MSC_VER)</div><div>+#   include <windows.h></div><div>+#endif</div><div>+</div><div> PIXMAN_DEFINE_THREAD_LOCAL (cache_t, fast_path_cache);</div><div> </div><div>
 static void</div><div><br></div><div><br></div>-- <br><p> </p><p>Alex Christensen</p><p>FlexSim Software Products, Inc.</p><p><i><span style="font-size:10pt">1577 North Technology Way | Building A | Suite 2300 | Orem, Utah 84097</span></i></p>
<p><i><span style="font-size:10pt">Voice: <a value="+18012246914" style="color:rgb(17,85,204)">801-224-6914</a> | Fax: <a value="+18012246984" style="color:rgb(17,85,204)">801-224-6984</a></span></i></p><p><i><span style="font-size:10pt">Email:</span></i><span style="font-size:10pt"> </span><a href="mailto:kimw@flexsim.com" style="color:rgb(17,85,204)" target="_blank"><span style="font-size:10pt;color:blue">alexc@flexsim.com</span></a><span style="font-size:10pt"></span></p>
<p><i><span style="font-size:10pt">URL:</span></i><span style="font-size:10pt"> </span><a href="http://www.flexsim.com/" style="color:rgb(17,85,204)" target="_blank"><span style="font-size:10pt;color:blue">www.flexsim.com</span></a><span style="font-size:10pt"></span></p>
<p> </p><p><span style="font-size:10pt">----------------------------------------------------------------------------------------</span><span style="font-size:12pt"> <br></span><span style="font-size:10pt">This message may contain confidential information, and is</span><span style="font-size:12pt"> </span><span style="font-size:10pt">intended</span></p>
<p><span style="font-size:10pt">only for the use of the individual(s) to whom it is</span><span style="font-size:12pt"> </span><span style="font-size:10pt">addressed.</span><span style="font-size:12pt"> <br></span><span style="font-size:10pt">----------------------------------------------------------------------------------------</span></p>

</div></div></div>