Calling Clipper functions from C

One of the more common calls we receive in Technical Support is the
question about calling a Clipper UDF from C. It is commonly thought
that if C can be called from Clipper, then Clipper functions and C
functions must be operate identically. This is not the case.
Anyone familiar with the way C calls a function knows that C pushes
strongly-typed arguments on the processor stack and then does a jump
to the function that is being called. Clipper does not use the
processor stack for the passing of arguments to functions. Clipper
functions operate within an "activation context" that must be
established before the Clipper function is called. This allows
Clipper to support loosely-typed arguments, variable number of
arguments, as well as functions such as PROCNAME(). This means that
even if you succeeded in calling a Clipper function, you would be
unable to pass it parameters, and it would be operating "out of
context."

The extend system also assumes that it has complete control over
virtual memory while you are executing a C or assembler function. If
you call a Clipper function, this assumption is no longer valid and
may cause the system to crash. Certain Clipper operations are also
inherently problematic: what happens if the Clipper function BREAKs
(or calls the error handler and it BREAKs)? There is no equivalent C
ability.