The C interface is a base for many other interfaces. It contains the pure C functions for most of the methods of MathGL classes. In distinction to C++ classes, C functions must have an argument HMGL (for graphics) and/or HMDT (for data arrays), which specifies the object for drawing or manipulating (changing). So, firstly, the user has to create this object by the function mgl_create_*() and has to delete it after the use by function mgl_delete_*().
All C functions are described in the header file #include <mgl2/mgl_cf.h> and use variables of the following types:
HMGL — Pointer to class mglGraph (see MathGL core).
HCDT — Pointer to class const mglDataA (see Data processing) — constant data array.
HMDT — Pointer to class mglData (see Data processing) — data array of real numbers.
HADT — Pointer to class mglDataC (see Data processing) — data array of complex numbers.
HMPR — Pointer to class mglParse (see mglParse class) — MGL script parsing.
HMEX — Pointer to class mglExpr (see Evaluate expression) — textual formulas for real numbers.
HMAX — Pointer to class mglExprC (see Evaluate expression) — textual formulas for complex numbers.
These variables contain identifiers for graphics drawing objects and for the data objects.
Fortran functions/subroutines have the same names as C functions. However, there is a difference. Variable of type HMGL, HMDT must be an integer with sufficient size (integer*4 in the 32-bit operating system or integer*8 in the 64-bit operating system). All C functions of type void are subroutines in Fortran, which are called by operator call. The exceptions are functions, which return variables of types HMGL or HMDT. These functions should be declared as integer in Fortran code. Also, one should keep in mind that strings in Fortran are denoted by ' symbol, not the " symbol.