Important Design Considerations
Now that we have the technical pitfalls out the way, I would like to
cover a couple design issues that I think will help in writing C UDFs
for use with Clipper.
The goal is to isolate the Clipper Extend System interface and Memory
allocation routines in the C function. This allows you to design the
C function so that it can be compiled as a Clipper UDF or as a stand
alone C program. This will greatly improve the flexibility of the
function and aids the debugging process as well. We will use a
#define to create a manifest constant for use as a flag that will be
tested with #ifdef and #ifundef compiler directives, to optionally
compile different parts of the code.
For example:
#define IS_CLIPPER
#ifdef IS_CLIPPER
<Some Clipper related code>
#else
<C code that emulates the Clipper code above>
#endif