[cairo] Re: Munging header files for export (and other) attributes
Mike Hearn
mike at plan99.net
Sat Sep 3 08:30:29 PDT 2005
Here's a slightly off-topic request to do with the header files: if you
modify macros in the headers such that the dependencies of code compiled
against them would change, can that be protected with a CAIRO_TARGET
define? To illustrate, if:
#define CAIRO_SOME_VALUE 30
... became ...
#define CAIRO_SOME_VALUE (cairo_get_some_value())
Then code whose developers thought it depended on Cairo 1.0 would get a
nasty surprise when they build binaries against Cairo 1.1 and find
themselves with a silent dependency on a new symbol.
A better and not really any harder way to do this is:
#if CAIRO_TARGET >= 1
#define CAIRO_SOME_VALUE 30
#else
#define CAIRO_SOME_VALUE (cairo_get_some_value())
#endif
And then when developers decide they want to gain automatically from
some new features like this they can just do:
#define CAIRO_TARGET 1
#include <cairo/cairo.h> // or whatever
and nothing unexpected happens.
This is generally accepted practice on Win32 and MacOS X although not in
the Linux world, but there's no harm in starting it here too :)
thanks -mike
On Tue, 30 Aug 2005 02:20:28 -0700, Carl Worth wrote:
> Every once in a while, someone asks to decorate cairo.h with some sort of
> per-function attribute.
More information about the cairo
mailing list