vips.h: problem with vips_init()

For version prior 7.41, vips_init() is a macro to VIPS_INIT().
VIPS_INIT() should be called, but as it is a macro, cgo could not
determine the return type, hence making the build fail.
So, we undef vips_init(), and define the vips_init() method.
This commit is contained in:
Thomas Meson 2015-09-08 14:31:54 +02:00
parent ae4046b5a5
commit 0e5ba53847
1 changed files with 19 additions and 0 deletions

19
vips.h
View File

@ -31,6 +31,25 @@ typedef struct {
double Background[3];
} WatermarkOptions;
/*
* This method is here to handle the weird initialization of the vips lib.
* libvips use a macro VIPS_INIT() that call vips__init() in version < 7.41,
* or calls vips_init() in version >= 7.41.
* Anyway, it's not possible to build bimg on Debian Jessie with libvips 7.40.x,
* as vips_init() is a macro to VIPS_INIT(), which is also a macro, hence, cgo
* is unable to determine the return type of vips_init(), making the build impossible.
* In order to correctly build bimg, for version < 7.41, we should undef vips_init and
* creates a vips_init() method that calls VIPS_INIT().
*/
#if (VIPS_MAJOR_VERSION == 7 && VIPS_MINOR_VERSION < 41)
# undef vips_init
int
vips_init(const char *argv0)
{
return VIPS_INIT(argv0);
}
#endif
void
vips_enable_cache_set_trace()
{