cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Version info in curl.h (was Re: Companies Using curl)

From: Eduardo García <garedagmad_at_telefonica.net>
Date: Tue, 09 Mar 2004 13:38:46 +0100

At 13:04 09/03/2004, you wrote:
>On Tue, 9 Mar 2004, Eduardo García wrote:
>
> > Having introduced ourself, we have a little issue with libcurl MSVC
> > compilation that is be very easy to solve and we think should be solved in
> > this future 7.11.1 release: the library (dll) is rebuilt again by the
> > compiler (VisualStudio7(.net), both 2002 or 2003 editions) every time it
> > checks if it's up-to-date.
>
> > This is because of the resource including of curl.h for version
> > defines, with makes it includes all standard C and windows headers, and
> > makes the compiler think resources are not up-to-date every time it checks
> > before compilation of other project in the same workspace ("solution",
> as it
> > is called in VS7) or at the beginning of every debugging sesion.
>
>This puzzles me! I'd appreciate some more details on this weirdness.

In VisualStudio you (can) define a "work environment" for your entire
project (your complete application) what (may) includes your main project
(exe or dll or whatever) and (optionally) its dependencies if they are
under your development, or they are suitable for your debugging/tracking...
A main Exe and some customizable dlls, for instance.

Whenever you build the main project (or try to debug it), VS checks its
dependencies in case they have been changed and need to be rebuilt.

We use to include libraries as libcurl whenever we have code for it.
Usually the library may be updated during project development, and then
version conflicts use often to rise sooner or later. Having the library in
the project make sure to be using always the correct version.

>Why does it think that? Besides, why is this only an issue in curl.h?
>libcurl source files include standard header files all over, why are they not
>causing problems too then?
>
>Or are you saying that this is only happening because that file is included
>from the src/curl.rc file?

That's right.

>If so, why isn't the inclusion of <winver.h> from that file also a problem?

For some reason (we have not yet discovered), only std system headers such
as windows.h affect to resource compiler, but not simple defines as curlver
will have.

>So, the compiler thinks one of the system headers have been changed so it
>rebuilds the resource file and then rebuilds the whole project or what?

Only libcurl resources, but that make a new dll, and lib and forces the
entire dependance workspace to be also relinked, even rebuilt if some curl
headers are copied onto a general include directory as part of the building
process.

>Anyway, is this really such a big problem? You don't need to run make in the
>curl source directory all the time! ;-)

Well, I said it is a "little issue", not an operational problem. It is just
an inconvenience most of windows developers will find with libcurl MSVC
project as it is defined. We don't think to be the only developers using
VStudio in this way, an so having this disappointment.

> > LIBCURL_VERSION, LIBCURL_VERSION_NUM, LIBCURL_VERSION_MAJOR,
> > LIBCURL_VERSION_MINOR, and LIBCURL_VERSION_PATCH should be defined in a
> > separate header curl_ver.h included both by curl.h and the resources file
> > (libcurl.rc), and so resources will not include main headers included by
> > curl.h.
> >
> > We understand this little change will not affect any other OS build.
>
>True, but it would add an extra header file for no apparent reason.

Perhaps some kind of #ifdef isolating these defines from the rest of the
code would also work (#define CURLVERSION_DEFS in .rc before curl.h include
and exclude rest of curl.h if defined), avoiding to separate an extra
header file. Nevertheless, what are these defines there for? are they used
in any other part of the code ?

You are the the master for the project. It is your decision ;-)

Eduardo García
Received on 2004-03-09