Top |
#define | VIPS_INIT() |
int | vips_init () |
const char * | vips_get_argv0 () |
void | vips_shutdown () |
void | vips_thread_shutdown () |
void | vips_add_option_entries () |
void | vips_leak_set () |
const char * | vips_version_string () |
int | vips_version () |
const char * | vips_guess_prefix () |
const char * | vips_guess_libdir () |
Start VIPS up, shut VIPS down, get version information, relocation.
VIPS is a relocatable package, meaning you can move the directory tree you
compiled it to at runtime and it will still be able to find all data files.
This is required for OS X and Windows, but slightly unusual in the Unix
world. See vips_init()
and vips_guess_prefix()
.
#define VIPS_INIT( ARGV0 )
VIPS_INIT
is deprecated and should not be used in newly-written code.
VIPS_INIT() starts up the world of VIPS. You should call this on
program startup before using any other VIPS operations. If you do not call
VIPS_INIT()
, VIPS will call it for you when you use your first VIPS
operation, but it may not be able to get hold of ARGV0
and VIPS may
therefore be unable to find its data files. It is much better to call
this macro yourself.
VIPS_INIT() is a macro, since it tries to check binary compatibility between the caller and the library.
VIPS_INIT() does approximately the following:
checks that the libvips your program is expecting is binary-compatible with the vips library you're running against
initialises any libraries that VIPS is using, including GObject and the threading system, if neccessary
guesses where the VIPS data files are and sets up
internationalisation --- see vips_guess_prefix()
creates the main vips types, including VipsImage and friends
loads any plugins from $libdir/vips-x.y/, where x and y are the major and minor version numbers for this VIPS.
Example:
int main (int argc, char **argv) { if (VIPS_INIT (argv[0])) vips_error_exit ("unable to start VIPS"); vips_shutdown (); return 0; }
See also: vips_shutdown()
, vips_get_option_group()
, vips_version()
,
vips_guess_prefix()
, vips_guess_libdir()
.
int
vips_init (const char *argv0
);
This function starts up libvips, see VIPS_INIT()
.
This function is for bindings which need to start up vips. C programs
should use the VIPS_INIT()
macro, which does some extra checks.
See also: VIPS_INIT()
.
const char *
vips_get_argv0 (void
);
See also: VIPS_INIT()
.
a pointer to an internal copy of the argv0 string passed to
VIPS_INIT()
. Do not free this value
void
vips_shutdown (void
);
Call this to drop caches and close plugins. Run with "--vips-leak" to do a leak check too. May be called many times.
void
vips_thread_shutdown (void
);
Free any thread-private data and flush any profiling information.
This function needs to be called when a thread that has been using vips
exits. It is called for you by vips_shutdown()
and for any threads created
by vips_g_thread_new()
.
You will need to call it from threads created in other ways or there will be memory leaks. If you do not call it, vips will generate a warning message.
It may be called many times, and you can continue using vips after calling it. Calling it too often will reduce performance.
void
vips_add_option_entries (GOptionGroup *option_group
);
Add the standard vips GOptionEntry
to a GOptionGroup
.
See also: g_option_group_new()
.
void
vips_leak_set (gboolean leak
);
Turn on or off vips leak checking. See also --vips-leak and
vips_get_option_group()
.
You should call this very early in your program.
const char *
vips_version_string (void
);
Get the VIPS version as a static string, including a build date and time. Do not free.
int
vips_version (int flag
);
Get the major, minor or micro library version, with flag
values 0, 1 and
2.
const char * vips_guess_prefix (const char *argv0
,const char *env_name
);
vips_guess_prefix() tries to guess the install directory. You should pass in the value of argv[0] (the name your program was run as) as a clue to help it out, plus the name of the environment variable you let the user override your package install area with (eg. "VIPSHOME").
On success, vips_guess_prefix()
returns the prefix it discovered, and as a
side effect, sets the environment variable (if it's not set).
Don't free the return string!
See also: vips_guess_libdir()
.
const char * vips_guess_libdir (const char *argv0
,const char *env_name
);
vips_guess_libdir() tries to guess the install directory (usually the configure libdir, or $prefix/lib). You should pass in the value of argv[0] (the name your program was run as) as a clue to help it out, plus the name of the environment variable you let the user override your package install area with (eg. "VIPSHOME").
On success, vips_guess_libdir()
returns the libdir it discovered, and as a
side effect, sets the prefix environment variable (if it's not set).
Don't free the return string!
See also: vips_guess_prefix()
.