Isolate the C function from the Clipper Extend System
The first step is to create a pure C function that does not have any
Clipper Extend system code in it. This function should be created
and prototyped as a normal C function. Next we create a small
function that contains all the Extend System interface code. This is
the function we actually call from Clipper. It is this function that
contains all of the Extend System code to retrieve parameters from
Clipper, and to return a value back to Clipper. Since the pure C
function actually performs the work, we gain the ability to call it
from other C functions as well as from Clipper.
This means we can optionally compile a Clipper Extend System
interface function or a C Main function, and either one will work
properly. The ability to compile the function as a stand alone
program is a great help when testing and debugging. The goal should
be to create a fully functional, stand alone program, that works
correctly before trying to interface it to Clipper.