freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] FT_UINT_TO_POINTER & other problems with cross-compile for wi


From: Hin-Tak Leung
Subject: [ft-devel] FT_UINT_TO_POINTER & other problems with cross-compile for win64
Date: Fri, 12 May 2017 05:21:38 +0000 (UTC)

Hi Werner,

It seems that your solution to 
https://savannah.nongnu.org/bugs/index.php?50560
is simply wrong - it turns a warning into a complete failure :-).

The thing is, on win64, at least for cross-compiling for it,
FT_UInt64 (and possibly FT_Int64 also) is not defined. It seems
to be emulated (as far as later collision at ftcalc.c goes, if I define 
FT_Int64 as __int64).

What I find work for me is this change:

===
diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in
index b0ef313..abd101d 100644
--- a/builds/unix/ftconfig.in
+++ b/builds/unix/ftconfig.in
@@ -368,7 +368,7 @@ FT_BEGIN_HEADER
 #ifdef _WIN64
   /* only 64bit Windows uses the LLP64 data model, i.e., */
   /* 32bit integers, 64bit pointers                      */
-#define FT_UINT_TO_POINTER( x ) (void*)(FT_UInt64)(x)
+#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x)
 #else
 #define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
 #endif
===

Also on another win64 issue - I am looking at another interesting patch for 
streaming in memory for FontVal (for windows). Somebody wanted this done,
because, as you know, long is still only 32-bit on win64:

===
diff -pNaur include_old/ftsystem.h include/ftsystem.h
--- include_old/freetype/ftsystem.h     2015-03-11 06:47:11.000000000 +0100
+++ include/freetype/ftsystem.h 2017-05-07 20:17:21.707763600 +0200
@@ -330,8 +330,13 @@ FT_BEGIN_HEADER
   typedef struct  FT_StreamRec_
   {
     unsigned char*       base;
+#if _WIN64
+    unsigned __int64     size;
+    unsigned __int64     pos;
+#else
     unsigned long        size;
     unsigned long        pos;
+#endif
 
     FT_StreamDesc        descriptor;
     FT_StreamDesc        pathname;
===

and if I do that, src/cid/type1cid.c breaks unless I do:

===
--- a/src/cid/type1cid.c
+++ b/src/cid/type1cid.c
@@ -18,6 +18,7 @@
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 #include <ft2build.h>
+#include FT_CONFIG_CONFIG_H
 
 #include "cidgload.c"
 #include "cidload.c"
===

so it looks like the __int64 type needs FT_CONFIG_CONFIG_H, at least for 
mingw-cross.


I am not sure if __int64 is specific to mingw-gcc or would it breaks compiling 
with visual studio; but here are the changes that works for me.

Hin-Tak


reply via email to

[Prev in Thread] Current Thread [Next in Thread]