Programming Languages
You can program your TQ-library with the FORTRAN or C programming languages.
FORTRAN
No special consideration is needed when interfacing the TQ-library with a program written in FORTRAN; the main core of the TQ-library is written in FORTRAN. By default all parameters are passed to routines by reference, except for strings, which are passed by descriptor.
C-Interface
The C-interface acts as a translation layer in between the calling C-program and the underlying FORTRAN TQ-library.
For a C-interface, the default parameter passing mechanism is by value and not by reference. Some decisions must be made as to how parameters, which are updated in the TQ-Interface, are then passed into the library. For example:
- The C procedures are defined in the file tqroot.h which should be included in the procedures using the library calls in C.
- The tqroot.h file also includes the file tc_data_defs.h where the datatypes are defined.
The definition of some of these data types vary depending on what platform and compiler is used. It is important to define these and for the definitions to be correctly set.

The commonly used definitions in the C-interface are listed in the table. Note that:
- TC_INT and TC_FLOAT are used when only the value of the variables is necessary to pass.
- TC_INT* and TC_FLOAT* are used when the variables are updated and values are returned within these.
- When a TC_STRING is updated, the allocated size of the string must be passed into the interface in a variable declared as TC_STRING_LENGTH.
Routine | Definitions |
---|---|
TC_INT |
An integer of platform dependent length passed by value. |
TC_INT* |
Address of an integer of platform dependent length. |
TC_FLOAT |
A 64-bit real passed by value. |
TC_FLOAT* |
Address of a 64-bit real. |
TC_STRING |
Address of a character string. |
TC_STRING_LENGTH |
An integer of platform dependent length passed by value defining the length of the string. |