Go to the first, previous, next, last section, table of contents.


2 Using libgimpprint

This chapter describes how to write programs that use libgimpprint.

2.1 Code prerequisites

To use libgimpprint with a program, several steps must be taken:

  1. Include the master libgimpprint header <gimp-print/gimp-print.h>.
  2. Call stp_init().
  3. Link with libgimpprint.

The following is a short example program. It does not do anything useful, but it does everything required to link with libgimpprint and call other functions from libgimpprint.

#include <gimp-print/gimp-print.h>

int
main (int argc, char *argv[])
{
  stp_init ();
  return (0);
}

2.2 Linking with libgimpprint

To link a program with libgimpprint, then `-lgimpprint' needs to be passed to the compiler when linking. For example, to compile and link `prog.c' the following commands would be used:

gcc -c prog.c
gcc -o prog -lgimpprint prog.o

The compiler and linker flags needed may vary depending on the options GIMP-Print was configured with when it was built. The @command{gimpprint-config} script will give the correct parameters for the local installation (see section 3.1 @command{gimpprint-config}).


Go to the first, previous, next, last section, table of contents.