[HarfBuzz] Fixes for harfbuzz-ng on Windows MSVC2010

Koji Ishii kojiishi at gmail.com
Thu Jul 12 09:33:37 PDT 2012


Thank you Behdad for the response.

> > hb-unicode-private.hh fix is probably not related with Windows nor
> > MSVC, but when neither GLIB nor ICU is available.
> 
> Applied.

Great, thank you.


> > hb-uniscribe.cc fix is required for me, maybe Windows SDK was changed?
> > I'm using VC2010 SP1, but the fix should be safe for prior compilers I
> > believe.
> 
> I see.  I just bumped our _WIN32_WINNT version, since we use the OpenType
> version of the Uniscribe functions.  Let me know if that addresses your problem.

Yes, that solves my problem, thank you again.


> > hb-atomic-private.hh fix is for x86 only. The current code builds fine
> > for x64 but not for x86.
> 
> I don't understand why this is needed.  According to:
> 
>   http://msdn.microsoft.com/en-us/library/1b4s3xf5%28v=vs.80%29.aspx
> 
> _InterlockedCompareExchangePointer is available on both x86 and x64.

And the page says:
Note   On the x86 architecture, _InterlockedCompareExchangePointer is a macro that calls _InterlockedCompareExchange.

So, you can't declare it as intrinsic, and the macro is defined in concrt.h, not in intrin.h.

I guess I've got better fix thanks to your advice. How's this? This compiles good too, and we don't hard code the macro any longer. I still see some warnings on both x86/x64, but that's a separate issue.

Regards,
Koji

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 918852d..3653608 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -45,7 +45,12 @@
 #elif !defined(HB_NO_MT) && defined(_MSC_VER) && _MSC_VER >= 1600
 
 #include <intrin.h>
+#if defined(_M_IX86)
+#include <concrt.h>
+#pragma intrinsic(_InterlockedExchangeAdd)
+#else
 #pragma intrinsic(_InterlockedExchangeAdd, _InterlockedCompareExchangePointer)
+#endif
 
 typedef long hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)	_InterlockedExchangeAdd (&(AI), (V))




More information about the HarfBuzz mailing list