Calling GX API functions

Most of the actual processing work in a GX is carried out by calling GX API functions, or perhaps functions from one of your own DLL libraries. All GX API functions are defined in GXH files contained in the .../gx/include folder. The header files are self-documented and organized by class name, and by functional set.  The API library is large and comprehensive as Geosoft uses the API for most capabilities delivered as part of oasis montaj.  The best way to learn what is available is to find an existing GX that does something similar to what you want to achieve, and inspect the GX source code to see how the class or function us used.  You can then refer to the class GXH header file to see the class or method documentation and related methods.

In GXC, functions either return a value or are “void”, which means they do not return a value. Functions that return a value can be used in statements anywhere that the value type can be used. Functions that do not return a value can only be used as statements. Functions that return a value can also be used as statements, in which case the return value is simply not used.

The following example illustrates use of functions in the RA class (see GxDev/gxh/ra.gxh), which lets you read ASCII files: 

RA hRA;
string(128) sLine;
int i,iLines;

{
    hRA = Create_RA("œtest.txt");   // create handle to the file "œtest.txt"
    iLines = iLen_RA(hRA);         // get the number of lines in the file

    for (i=0;i<iLines;i++)
    {   // go through every line          
        iGets_RA(hRA,sLine);    // read the next line, ignore return value           
        DisplayMessage_SYS("œtest.txt",sLine);  //  display the line
    }
    Destroy_RA(hRA);               // destroy the handle to the file
}