[Top][All Lists]

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

FT2 "interface" keyword problem with MS Visual C?

From: Jack Davis
Subject: FT2 "interface" keyword problem with MS Visual C?
Date: Thu, 17 Feb 2000 12:58:46 -0800

When compiling a FreeType2 sample program under Microsoft Visual C (v6), Visual 
C treats "interface" as a keyword and flags references to "interface" as an 
error in freetype.h (in the Visual C editor, "interface" also shows up 
highlighted in blue recognized as a keyword).  For example:

   int  FT_Decompose_Outline( FT_Outline*        outline,
                              FT_Outline_Funcs*  interface,
                              void*              user );

is flagged with an error.  Changing the word "interface" to something else 
makes Visual C happy:

   int  FT_Decompose_Outline( FT_Outline*        outline,
                              FT_Outline_Funcs*  funcInterface,
                              void*              user );

There's only two places where "interface" is used, and in the function 
prototypes it's easy to change and doesn't effect anything.

ftoutln.h, however, #includes <ftobjs.h> which then #includes <ftconfig.h>, 
<ftsystem.h> and <ftdriver.h>  (ftoutln.h is needed for the function prototype 
of FT_Get_Outline_Bitmap).  ftdriver.h also has a function prototype using 
"interface" (changeable without effecting anything else).  The real killer is 
that ftobjs.h uses a structure with a variable name "interface":

   typedef struct  FT_DriverRec_
     FT_Library          library;
     FT_Memory           memory;
     FT_Generic          generic;
     FT_DriverInterface  interface;    // <---- VC v6 error!
     FT_FormatInterface  format;
     FT_Int              version;      /* driver version     */
     FT_String*          description;  /* format description */
     FT_ListRec          faces_list;   /* driver's faces list    */
     void*               extensions;
   } FT_DriverRec;

ftobjs.h(307) : error C2236: unexpected 'struct' '$S1'
ftobjs.h(307) : error C2027: use of undefined type '$S1'
ftobjs.h(307) : see declaration of '$S1'

Unfortunately changing the word "interface" here would also mean changing all 
references to it in the FT2 code.

Has anyone experience this behavior in VC6 before where "interface" is treated 
as a reserved keyword?  "interface" seems to have been promoted to a keyword in 
support of COM, but I've searched through the MSDN docs but can't find any 
reference to compiler switch or "define" that controls this behavior.  
Interestingly, my freetype library build using Visual C seems to compile fine, 
this only happens when compiling my test program.

Thanks for any suggestions,

PS: For the time being I've temporarily patched my version of freetype.h and 
added the FT_Get_Outline_Bitmap() prototype directly in my application header 
file so I don't have to #include <ftoutln.h>.

reply via email to

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