[Openmcl-devel] defcallback and doubles

Chris Curtis enderx12 at mac.com
Thu Jul 14 12:41:30 PDT 2005


Hello all,

I'm having a strange problem with a defcallback'ed function that  
takes doubles. The function signature in C is:

int (*pfunc)(const char*, const char*, const char*, double, double,  
double, double, double, double, void*)

(I didn't write it.)

My callback function looks like this:

(defcallback my-cb-func ((:* :char) s1 (:* :char) s2 (:* :char) s3
                          :double d1 :double d2 :double  
d3 :double :d4 :double d5 :double d6
                          (:* T) ref
                          :integer)
   (format t "~A ~A ~A ~G ~G ~G ~G ~G ~G~%" (ccl::%get-cstring s1)  
(ccl::%get-cstring s2)
            (ccl::%get-cstring s3) d1 d2 d3 d4 d5 d6))


When this callback is executed by the C library I'm using, the three  
cstrings are handled correctly but the doubles are way off, seeming  
to indicate that somehow the wrong value and/or wrong alignment is  
being used for those parameters.

If I call the same callback using ff-call, it works correctly. I'm  
not even sure how to debug this further yet. Is there something  
obvious I'm missing?

Thanks,

--chris




More information about the Openmcl-devel mailing list