Re: Problems with compiling libcurl on Visual C++
Date: Wed, 14 Feb 2007 03:33:52 +0100
On Tue, 13 Feb 2007, Robert (Bob) A. Monat wrote:
> From what I can tell, if you create threads according to the way
> Microsoft recommends, then each thread has its own memory and there is
> no need for the _r (e.g. gmtime_r) version of routines. I was not able
> to find a reference to gmtime_r() for Microsoft. Someone thought there
> was such a need.
I completely agree with Robert. And even go further...
HAVE_GMTIME_R should be unconditionally undefined for all builds if
(_MSC_VER) is defined.
Definition of HAVE_GMTIME_R for _MSC_VER builds seems to come from
MS compilers do not have/use gmtime_r
The fact is that thread safeness on Windows is granted depending on
the CRT which is linked, not the name of the function.
But... caveat emptor. Using gmtime, localtime and mktime is a lot of
fun on Windows. All three use a single, _the_same_one_, statically
allocated buffer, and can even destroy its input. So the only way of
using them if you are using them more than once in the same piece of
code is making shadow copies of vars before passing them to the other
This is already addressed at lib/parsedate.c lines 394 to 406 of revision 1.23
- text/plain attachment: msvc_gmtime_r.patch