Vips.INIT
Description: Reference for Vips.INIT

### Function Macro

# VipsINIT

#### Declaration [src]

    #define VIPS_INIT (
      ARGV0
    )

#### Description [src]

`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.

`ARGV0` is used to help discover message catalogues if libvips has been relocated. If you don’t need a relocatable package, you can just pass `""` and it’ll be fine.

Additionally, `VIPS_INIT()` can be run from any thread, but it must not be called from more than one thread at the same time. This is much easier to guarantee if you call it yourself.

`VIPS_INIT()` is a macro, since it tries to check ABI compatibility between the caller and the library. You can also call `vips_init()`, the non-macro version, if macros are not available to you.

You may call `VIPS_INIT()` many times and `vips_shutdown()` many times, but you must not call `VIPS_INIT()` after `vips_shutdown()`. In other words, you cannot stop and restart vips.

Use the environment variable `VIPS_MIN_STACK_SIZE` to set the minimum stack size. For example, `2m` for a minimum of two megabytes of stack. This can be important for systems like musl where the default stack is very small.

`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

- sets a minimum stack size, see above

- initialises any libraries that VIPS is using, including GObject and the threading system, if necessary

- 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_add_option_entries()`, `vips_version()`, `vips_guess_prefix()`, `vips_guess_libdir()`.

This function is not directly available to language bindings.

#### Parameters

`ARGV0`

  Type: `-`

  Name of application.