The Plotutils Package - C Compiling and Linking

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

### C compiling and linking

The source code for a graphics application written in C, if it is to use `libplot`, must contain the lines

    #include <stdio.h>
    #include <plot.h>

The header file `plot.h` is distributed with `libplot`, and should have been installed on your system where your C compiler will find it. It contains prototypes for each of the functions in `libplot`, and some miscellaneous definitions.

In current releases of `libplot`, the names of all functions begin with the prefix "pl_". For example, the `openpl` operation is invoked on a Plotter by calling the function `pl_openpl`. If you wish, you may maintain backward compatibility by also including the header file `plotcompat.h`. This header file redefines `openpl` as `pl_openpl`, and similarly for the other `libplot` functions.

To link your application with `libplot`, you would use the appropriate ``-l'` option(s) on the command line when compiling it. You would use

    -lplot -lXaw -lXmu -lXt -lXext -lX11 -lm

or, in recent releases of the X Window System,

    -lplot -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -lm

(Alternatively, you may need to use ``-lplot -lXm -lXt -lXext -lX11 -lm'`, ``-lplot -lXm -lXt -lXext -lX11 -lm -lc -lgen'`, or ``-lplot -lXm -lXt -lXext -lX11 -lm -lc -lPW'`, on systems that provide Motif widgets instead of Athena widgets. In recent releases of the X Window System, you would insert ``-lSM -lICE'`. Recent releases of Motif require ``-lXp'` as well.)

On some platforms, the directories in which `libplot` or the other libraries are stored must be specified on the command line. For example, the options ``-lXaw -lXmu -lXt -lSM -lICE -lXext -lX11'`, which specify X Window System libraries, may need to be preceded by an option like ``-L/usr/X11/lib'`.

On most systems `libplot` is installed as a DLL (dynamically linked library, or `shared' library). This means that the linking with your application will take place at run time rather than compile time. The environment variable `LD_LIBRARY_PATH` lists the directories which will be searched for DLL's at run time. For your application to be executable, this environment variable should include the directory in which `libplot` is stored.

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