vips_init() does ABI checking
just checks sizeof(VipsObject) for now
This commit is contained in:
parent
7ef4573f18
commit
f7f061d265
@ -1,5 +1,7 @@
|
||||
19/10/13 started 7.37.0
|
||||
- redone im_rotate_*mask45(), im_gauss_*mask*(), im_log_*mask*() as classes
|
||||
- redone im_rotate_*mask45(), im_gauss_*mask*(), im_log_*mask() as classes
|
||||
- vips_init() now does some ABI compat checking, though this change requires
|
||||
an ABI break
|
||||
|
||||
18/10/13 started 7.36.3
|
||||
- fix compiler warnings in ubuntu 13.10
|
||||
|
12
TODO
12
TODO
@ -1,15 +1,3 @@
|
||||
- do log mask generation, common base class with the gauss mask builder?
|
||||
|
||||
- make vips_init() into a macro, check sizes of important structs against size
|
||||
at library compile time
|
||||
|
||||
add a new API call like vips__get_sizeof_image() which returns
|
||||
sizeof(VipsImage) from library compile time, compare that to the application
|
||||
compile-time value
|
||||
|
||||
vips_init() macro then passes control on to vips__init() for real startup
|
||||
|
||||
breaks binary API sadly
|
||||
|
||||
- do conv and morph quickly as simple wrappers over the vips7 operations
|
||||
|
||||
|
@ -50,6 +50,12 @@
|
||||
#include <vips/vector.h>
|
||||
#include <vips/transform.h>
|
||||
|
||||
int
|
||||
im_init_world( const char *argv0 )
|
||||
{
|
||||
return( vips_init( argv0 ) );
|
||||
}
|
||||
|
||||
VipsImage *
|
||||
im_open( const char *filename, const char *mode )
|
||||
{
|
||||
|
@ -56,6 +56,11 @@ extern "C" {
|
||||
*/
|
||||
#define VIPS_SIZEOF_HEADER (64)
|
||||
|
||||
/* Startup plus ABI check.
|
||||
*/
|
||||
int vips__init( const char *argv0 );
|
||||
size_t vips__get_sizeof_vipsobject( void );
|
||||
|
||||
/* What we track for each mmap window. Have a list of these on an openin
|
||||
* VipsImage.
|
||||
*/
|
||||
|
@ -149,8 +149,20 @@ extern "C" {
|
||||
#include <vips/almostdeprecated.h>
|
||||
#include <vips/dispatch.h>
|
||||
|
||||
#define vips_init( ARGV0 ) \
|
||||
(sizeof( VipsObject ) != vips__get_sizeof_vipsobject() ? ( \
|
||||
vips_info( "vips_init", "%s", _( "ABI mismatch" ) ), \
|
||||
vips_info( "vips_init", \
|
||||
_( "library has sizeof(VipsObject) == %zd" ), \
|
||||
vips__get_sizeof_vipsobject() ), \
|
||||
vips_info( "vips_init", \
|
||||
_( "application has sizeof(VipsObject) == %zd" ), \
|
||||
sizeof( VipsObject() ) ), \
|
||||
vips_error( "vips_init", "%s", _( "ABI mismatch" ) ), \
|
||||
-1 ) : \
|
||||
vips__init( ARGV0 ))
|
||||
|
||||
const char *vips_get_argv0( void );
|
||||
int vips_init( const char *argv0 );
|
||||
void vips_check_init( void );
|
||||
void vips_shutdown( void );
|
||||
GOptionGroup *vips_get_option_group( void );
|
||||
|
@ -203,7 +203,6 @@ extern "C" {
|
||||
#define im_get_argv0 vips_get_argv0
|
||||
#define im_version_string vips_version_string
|
||||
#define im_version vips_version
|
||||
#define im_init_world vips_init
|
||||
#define im_get_option_group vips_get_option_group
|
||||
#define im_guess_prefix vips_guess_prefix
|
||||
#define im_guess_libdir vips_guess_libdir
|
||||
@ -586,6 +585,8 @@ size_t im_ref_string_get_length( const GValue *value );
|
||||
#define im_concurrency_set vips_concurrency_set
|
||||
#define im_concurrency_get vips_concurrency_get
|
||||
|
||||
int im_init_world( const char *argv0 );
|
||||
|
||||
int im_add( VipsImage *in1, VipsImage *in2, VipsImage *out );
|
||||
int im_subtract( VipsImage *in1, VipsImage *in2, VipsImage *out );
|
||||
int im_multiply( VipsImage *in1, VipsImage *in2, VipsImage *out );
|
||||
|
@ -140,7 +140,7 @@ vips_get_argv0( void )
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>loads any plugins from $libdir/vips-x.y, where x and y are the
|
||||
* <para>loads any plugins from $libdir/vips-x.y/, where x and y are the
|
||||
* major and minor version numbers for this VIPS.
|
||||
* </para>
|
||||
* </listitem>
|
||||
@ -165,8 +165,13 @@ vips_get_argv0( void )
|
||||
*
|
||||
* Returns: 0 on success, -1 otherwise
|
||||
*/
|
||||
|
||||
/* vips_init() is actually a macro which checks library and application
|
||||
* compatibility before calling vips__init().
|
||||
*/
|
||||
|
||||
int
|
||||
vips_init( const char *argv0 )
|
||||
vips__init( const char *argv0 )
|
||||
{
|
||||
extern GType vips_system_get_type( void );
|
||||
|
||||
@ -299,6 +304,20 @@ vips_init( const char *argv0 )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Return the sizeof() various important data structures. These are checked
|
||||
* against the headers used to build our caller by vips_init().
|
||||
*
|
||||
* We allow direct access to members of VipsImage and VipsRegion (mostly for
|
||||
* reasons of history), so any change to a superclass of either of these
|
||||
* objects will break our ABI.
|
||||
*/
|
||||
|
||||
size_t
|
||||
vips__get_sizeof_vipsobject( void )
|
||||
{
|
||||
return( sizeof( VipsObject ) );
|
||||
}
|
||||
|
||||
/* Call this before vips stuff that uses stuff we need to have inited.
|
||||
*/
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user