cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Howto: Use libcurl with MinGW.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 10 Feb 2007 10:56:00 +0100 (CET)

On Sat, 10 Feb 2007, jason cipriani wrote:

> Do this if you want to use libcurl on mingw and you are having problems.

Thanks for sharing this with us, I'm sure there are mingw users who will enjot
this!

> 4) To get applications to compile with curl.h using mingw gcc you have to
> edit one small thing in curl.h. Open up include_path/curl/curl.h. There's no
> such thing as a "long long" in ISO C++.

There is such a thing as long long in GNU C and it was added to the C language
in the C99 standard. libcurl is not C++.

So, how come you don't have long long? It really puzzles me, since mingw is
gcc and gcc has supported long long for many years.

> I'm guessing, based on the format string, that it wants a 64-bit signed
> integer, so change that little bit of code to:
>
> #if (defined(__GNUC__) && defined(WIN32)) || defined(__WATCOMC__)
> /* gcc on windows or Watcom */
> #include <stdint.h>
> typedef int64_t curl_off_t;
> #define CURL_FORMAT_OFF_T "%I64d"
>
> Note the stdint.h include. Incidently, to rant, I don't really get why
> there's all this mess in this header anyway... most of this stuff is already
> handled in system headers (like the int64_t), etc, and it seems like it
> would be a bit more sane to just check for the presence of those headers
> during autoconf and have a simple backup plan rather than doing all this
> system detection stuff here

Then let me rant back.

First, we of course provide that define to allow applications to be able to
printf() the curl_off_t type in a portable manner.

Since this is a header that is installed and is used by applications, it
cannot simply use #ifdefs based on configure results (like HAVE_BLABLABLA),
since the application may not use configure and may in fact not even be able
to, or can in fact use the same defined names for other purposes.

So, for that to work we have to generate a curl header with config defines at
build time that can be installed and then those defines could be checked in
this header file. That approach has its own set of problems, but I once
started on something like that with the patch available here:

         http://curl.haxx.se/mail/lib-2006-12/0084.html

I'm especially interested in ideas and solutions to this concept for the
platforms that cannot run configure.

> (and it might be nice to reduce the number of build packages from 100000 to
> 3 or 4).

I don't understand what this refers to.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-02-10