[Openmcl-devel] Erroneous results if function is untraced

Liam Healy lnp at healy.washington.dc.us
Tue Dec 30 18:51:52 PST 2008


On Tue, Dec 30, 2008 at 9:26 PM, Gary Byers <gb at clozure.com> wrote:
>
>
> I can't tell from the above what the problem is, so I don't
> know whether you're seeing a symptom of a known problem or
> something else.
>
> What does COPY-CL-TO-C do ?  (A reasonable guess is that it copies
> a CL object's contents to foreign memory somewhere/somehow, but
> that's just a guess and it's not clear where that somewhere would
> be.)
>
> Likewise, what does MPOINTER do ?
>
> There shouldn't be too much that TRACE does (except for some
> extra printing and consing) that directly affects a function's
> result.   Is there a PRINT-OBJECT method (or structure print-function)
> defined on PERMUTATION ? If so, does that method have side-effects
> that might interact with whatever it is that COPY-CL-TO-C and MPOINTER do ?
>

Since I'm calling foreign functions with arrays, I need to copy them
over.  You are right about COPY-CL-TO-C, it copies the contents of the
CL array over to the C side, then MPOINTER returns a pointer to the C
structure that holds the array for the foreign function to use.
There is in fact a print-object method defined, and I thought that
might be the key because it has potential side effects, but it doesn't
make any difference if I print the object with tracing off,

  (untrace)
NIL
? (let ((perm (make-permutation 4 T))) (permutation-reverse perm))
#<PERMUTATION #(0 0 0 0)>
? (let ((perm (make-permutation 4 T))) (print (permutation-reverse perm)))

#<PERMUTATION #(0 0 0 0)>
#<PERMUTATION #(0 0 0 0)>

Thanks.

Liam



More information about the Openmcl-devel mailing list