[antlr-interest] ANTLR on mingw

Jim Idle jimi at temporal-wave.com
Mon Aug 4 09:12:49 PDT 2008


On Mon, 2008-08-04 at 03:52 -0400, mp wrote:

> Hello.  I am a new user of ANTLR and I was reading on the newsgroups
> about
> (the lack of) mingw support.  Anyway, the only obstacle I ran into for
> compiling on mingw was the typdefs requiring INT8/INT16/UINT8/UINT16
> in
> 'antlr3defs.h' (around line 82).  I am not sure where microsoft
> typedefs
> these, but they are not defined in any of my headers files (I am
> running
> GCC 4.3.0 20080305), although the 32bit versions are already typedefed
> in
> 'basetsd.h', which gets included by way of winnt.h->windows.h. 

These are all part of the Microsoft basetsd.h file:

typedef signed char         INT8, *PINT8;
typedef signed short        INT16, *PINT16;
typedef signed int          INT32, *PINT32;
typedef signed __int64      INT64, *PINT64;
typedef unsigned char       UINT8, *PUINT8;
typedef unsigned short      UINT16, *PUINT16;
typedef unsigned int        UINT32, *PUINT32;
typedef unsigned __int64    UINT64, *PUINT64;

I have not deliberately excluded mingw from being supported, but as the
Microsoft compilers are freely available in .Net SDKS, then I could not
see the point of anyone using mingw anymore to be honest, so I put it
aside. Mingw should really have those typedefs though - see thousands of
Google hits on people complaining about this.


>  The fix is
> easy; typedef the missing types.  However, I have a suggestion to
> #include
> <stdint.h> and use the standard types defined there: int8_t,
> uint8_t, ...,
> uint64_t, instead of using the windows ones.  If you want, I will even
> do
> this for you.


stdint.h may be supplied with mingw, but it is not a part of the windows
headers. However, I think that Mingw defines: __MINGW32__ if it is the
compiler, so if stdint.h is always present when mingw is the compiler,
which I believe is the case, then I can modify the headers for mingw.

> 
> So anyway, after this one easy thing to fix, everything runs fine with
> mingw.  I used msys to run the configure script. 


I thought that mingw was designed to compile windows code - hence you
need to run configure on cygwin, but not if using mingw as the
antlr3config.h is not required in Windows systems.

I have changed the headers to reflect Mingw support - perhaps you can
ask the people that support mingw to update their typedefs?

Jim




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080804/abd76c88/attachment.html 


More information about the antlr-interest mailing list