RE: Question about some platform updates to Windows

2013-11-05 Thread Steve Holme
On Tue, 05 Nov 2013, Daniel Stenberg wrote:

> > What would you recommend regarding the gmtime_r versus gmtime_s issue? 
> > Under Visual Studio, gmtime_s can be used to implement gmtime_r, but 
> > not, say, MinGW unless you're on Windows Vista or later due to the
msvcrt.dll
> > version. Should I just implement gmtime_r in Windows myself, using
Win32's 
> > FileTimeToSystemTime and a bit of arithmetic?  This would work on all 
> > compilers.
>
> I'm not the proper person to give advice on how to polish things for
windows.

My apologies if I have misunderstood things in my rather quick catch up of
this thread but I would be interested to know if: These polishes are code
changes (in terms of better APIs that we could use, etc...), or compilation
settings, or a mixture of the two?

If they are compilation settings then these could be implemented via any of
the following:

A) VC12 specific alternations to the cmake config files
B) The introduction of a makefile.vc12
C) I talked with Daniel some months ago about bringing my Visual Studio
project files into the curl project. They not allow side-by-side building of
curl and libcurl against VC7.1 (Visual Studio .NET 2003), VC8 (2005), VC9
(2008) and VC10 (2010) so that no one build overwrites another build - In
this respect the project folder structure is based on those used by the
Apache's Xerces-C and Xalan projects (and possibly others), but my
configurations also allow for SSPI builds, OpenSSL builds, the use of
libSSH2, the usual debug and release builds, 32-bit builds, 64-bit builds as
well as static and dynamic libcurl builds with curl being able to use
either. The only drawback to these at the moment I have to manually update
the files when a new .c | .h file gets added, removed or renamed - I hope to
write a perl scripts that does this for me based on a template file but this
has taken a bit of a back burner at the moment!

Kind Regards

Steve
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Question about some platform updates to Windows

2013-11-05 Thread Daniel Stenberg

On Sun, 27 Oct 2013, Myria wrote:

I saw the #ifdef maze in config-win32.h and had no intention of breaking 
anything that was supported there.  However, I was worried somewhat because 
it looked like there were multiple ways to target Windows - CMake looked 
like it used some other mechanism than config-win32.h, for example.


There's many different ways to build on windows, and there are many different 
compilers available on windows that you can build with.


What's the difference between the lib\Makefile.vc10 and 
winbuild\Makefile.vc10?


They're two different implementations of the same thing: a build system for 
MSVC10 makefiles. One of them can probably go.


What would you recommend regarding the gmtime_r versus gmtime_s issue? Under 
Visual Studio, gmtime_s can be used to implement gmtime_r, but not, say, 
MinGW unless you're on Windows Vista or later due to the msvcrt.dll version. 
Should I just implement gmtime_r in Windows myself, using Win32's 
FileTimeToSystemTime and a bit of arithmetic?  This would work on all 
compilers.


I'm not the proper person to give advice on how to polish things for windows.

I'd rather reverse the question and ask what you suggest we do? A proper 
gmtime_r() should indeed improve libcurl...


--

 / daniel.haxx.se
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Question about some platform updates to Windows

2013-10-27 Thread Myria

From: Daniel Stenberg

On Thu, 24 Oct 2013, Myria wrote:


I'm just thinking of the ways the Windows support could be modernized. 
=^-^=



...
I'd like to fix up the curl library to support building curl/libcurl for


Just keep in mind that there are multiple windows (build) environments and 
that we keep support for oldish Windows versions as well.


I saw the #ifdef maze in config-win32.h and had no intention of breaking 
anything that was supported there.  However, I was worried somewhat because 
it looked like there were multiple ways to target Windows - CMake looked 
like it used some other mechanism than config-win32.h, for example.


What's the difference between the lib\Makefile.vc10 and 
winbuild\Makefile.vc10?


What would you recommend regarding the gmtime_r versus gmtime_s issue? 
Under Visual Studio, gmtime_s can be used to implement gmtime_r, but not, 
say, MinGW unless you're on Windows Vista or later due to the msvcrt.dll 
version.  Should I just implement gmtime_r in Windows myself, using Win32's 
FileTimeToSystemTime and a bit of arithmetic?  This would work on all 
compilers.


Melissa 


---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Question about some platform updates to Windows

2013-10-27 Thread Daniel Stenberg

On Thu, 24 Oct 2013, Myria wrote:


I'd like to fix up the curl library to support building curl/libcurl for


...


I'm just thinking of the ways the Windows support could be modernized. =^-^=


I'm sure there are lots of people here that will appreciate all the 
improvements you can throw at us!


Just keep in mind that there are multiple windows (build) environments and 
that we keep support for oldish Windows versions as well.


--

 / daniel.haxx.se
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Question about some platform updates to Windows

2013-10-24 Thread myriachan

 Gisle Vanem  wrote: 
> "Myria"  wrote:
> 
> > I noticed that Windows does not define HAVE_GMTIME_R or HAVE_LOCALTIME_R. 
> > It is true that Visual Studio's C runtime library doesn't have gmtime_r, 
> > but 
> > it has a somewhat-equivalent API, gmtime_s.  gmtime_s's prototype is 
> > different, reversing the order of the two parameters and returning an errno 
> > error code instead of the tm* parameter.  (gmtime_s took its reentrancy 
> > more 
> > seriously than gmtime_r, and doesn't modify the thread-local variable 
> > errno.)  The same applies to localtime_r existing in Visual Studio as 
> > localtime_s.
> 
> Without opening a can of worms [*] by using this new _gmtime64_s() function, 
> we could make a thread-safe Curl_gmtime() in libcurl too? It shouldn't be 
> that 
> hard; a call to gmtime64() protected inside a critical-section and with a 
> push/pop 
> of errno.

A push/pop of errno isn't required; gmtime_r on Ljnux and Darwin both set errno 
on failure but not success in my experiments.

> localtime_r() isn't used anywhere AFAICS. So what's this HAVE_LOCALTIME_R
> all about?

Vestigial to the curl project, I suppose, then.

> By "worms", I mean using a MSVCRT.DLL function in e.g. Vista that isn't 
> available
>   in Win-XP. So a libcurl.dll would not work everwhere.

This is only true of mingw, due to not having its own runtime.  If you build 
with Visual Studio 2005 or later, you're either going to link against 2005's 
static runtime, which has the gmtime_s family, or you're going to link against 
the dynamic runtime msvcrt80.dll, which exports the gmtime_s family.

Another alternative, by the way, is to use neither.  You can do some simple 
arithmetic to convert a time_t to a FILETIME, then use FileTimeToSystemTime to 
split into components.  Subtract 1900 from year then write to tm_year, for 
example -- write our own gmtime() based on the Win32 API.

> --gv

Melissa

---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: Question about some platform updates to Windows

2013-10-24 Thread Gisle Vanem

"Myria"  wrote:

I noticed that Windows does not define HAVE_GMTIME_R or HAVE_LOCALTIME_R. 
It is true that Visual Studio's C runtime library doesn't have gmtime_r, but 
it has a somewhat-equivalent API, gmtime_s.  gmtime_s's prototype is 
different, reversing the order of the two parameters and returning an errno 
error code instead of the tm* parameter.  (gmtime_s took its reentrancy more 
seriously than gmtime_r, and doesn't modify the thread-local variable 
errno.)  The same applies to localtime_r existing in Visual Studio as 
localtime_s.


Without opening a can of worms [*] by using this new _gmtime64_s() function, 
we could make a thread-safe Curl_gmtime() in libcurl too? It shouldn't be that 
hard; a call to gmtime64() protected inside a critical-section and with a push/pop 
of errno.


localtime_r() isn't used anywhere AFAICS. So what's this HAVE_LOCALTIME_R
all about?

By "worms", I mean using a MSVCRT.DLL function in e.g. Vista that isn't 
available
 in Win-XP. So a libcurl.dll would not work everwhere.

--gv
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html