As per section 8.7.5 of the CMUCL manual, I'd like to pass a Lisp (simple-array double-float) directly to a function. I'm not sure how to get this to work.
A long definition of a function called array-data-address is given, and then it's noted that system:vector-sap will do the same thing. And copying in the text of array-data-address seems to support this: * (setf a (make-array 10 :element-type 'double-float)) #(0.0d0 0.0d0 0.0d0 0.0d0 0.0d0 0.0d0 0.0d0 0.0d0 0.0d0 0.0d0) * (array-data-address a) #.(SYSTEM:INT-SAP #x4C6C6200) * (system:vector-sap a) #.(SYSTEM:INT-SAP #x4C6C6200) At the end of the section, they give an example of using this, where they get the address via something like: (system:int-sap (array-data-address x)) However, this does not seem to work for me: * (system:int-sap (system:vector-sap a)) Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER: #.(SYSTEM:INT-SAP #x4C7921F0) is not of type (UNSIGNED-BYTE 32) which makes sense, as a (describe 'system:int-sap indicates it wants an integer). But then how does the example work? I also tried a call of the form (in my program) (system:vector-sap array) But this causes segmentation violations inside the called C function, which I don't get if I allocate an alien object of the same size and pass that. Any idea what to do? Cheers, rif
