[postgis-devel] Re: [postgis-users] MSVC Patch #1

Charlie Savage cfis at savagexi.com
Tue Oct 30 09:48:36 PDT 2007


> Some feedback on the other parts of the patch that weren't applied:
> 
> - inttypes.h / stdint.h
> 
> I'm guessing that these are required to allow MSVC compatibility with
> snprintf()? Will these be useful for other platforms or is this purely
> for MSVC? 

Right - MSVC doesn't support the C99 standard so these files work around 
that.

Both inttypes.h and stdint.h are included by the lwgparse.c and 
wktunparse.c files.  If you could eliminate those dependencies, then it 
would be possible to eliminate these files.

> - rint.c
> 
> I was quite surprised that MSVC required this, since MingW doesn't
> require this at all. This seems to imply that rint() is already included
> as part as the MSVCRT - perhaps all that is needed is an alias from
> rint() to _rint() or something similar?

I don't think so - nothing on my search through the Internet indicated 
MSVC or MSVCRT had these functions.  It looks like MingW implments them 
itself.

> - config.h.vc/ config.h / unistd.h
> 
> I think I see that this is again adding extra headers for MSVC mainly to
> do with snprintf(); however it struck me that it may be better to
> combine these changes in a single header file and include it the main
> liblwgeom.h which should prevent duplication of the #ifdef _MSVC_VER
> statements and help maintenance in the future.

config.h just hard-codes various constants which in the default config.h 
.in file are filled in via autoconf macros.

The problem with combining them is that there is no config.h to start 
with unless you run ./configure which clearly you won't do if building 
with MSCV.

> Also one final thing - lex.yy.c is auto-generated, so in fact the
> changes need to go into wktparse.lex file which should then be run
> through flex.

Ah - of course.  Although this goes back to the same issue - if lex.yy.c 
is not checked into source control, how is a MSVC user supposed to get 
it?  They aren't going to be running lex/yacc.....

> Anyway, I hope this helps. I think that with a little bit more thought
> (and perhaps help from Mateusz) we should be able to get something
> applied for MSVC - I imagine that most of the questions are due to my
> lack of understanding of the MSVC build environment.

Ok - so to summarize:

1. Find a place for inttypes.h / stdint.h or eliminate dependencies on them.

2. Figure out what to do with config.h.in/config.h.vc

3.  Patch wktparse.lex.

Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20071030/a178a836/attachment.bin>


More information about the postgis-devel mailing list