Returning a Prolog term from a Foreign Function
     Prolog:  -term
     C:       QP_term_ref x;
     

An initialized QP_term_ref (defined in <quintus/quintus.h>) is passed to the C function. It is assumed that the function will assign a term to this QP_term_ref using one of the QP_put() functions. When the foreign function returns, the term that the QP_term_ref refers to is unified with the corresponding argument of the Prolog call. The argument can be of any type; if it cannot be unified with the referred term, the call will fail.