How to pass a C array to foreign callable?
Hi there, I am trying to pass an array of long signed ints from a dll to Lisp in order to have that filled. The callable looks like this: (fli:define-foreign-callable ("FillBufferLisp" :result-type :void) ((buflen :int) (arr (:c-array (:signed :long)))) (populate-farray buflen arr)) where buflen is the length of the array, and populate-farray populates the foreign array with data. The code is called from C like this: (*fbl)(buflen, arr); where *fbl is the pointer to the foreign callable and it appears to call lisp code just fine. However what happens when the callable is called is this error: Error: The subscript 0 exceeds the limit -1 for the first dimension of the foreign-array #<Foreign-Array (:SIGNED :LONG) (0): addr #x04CB0020>. It seems to me that the function expects the length of the array to be specified in the call (or definition?), but I cannot figure out how to do that. Or maybe it is something else. Any suggestions will be quite welcome. _______________________________________________ Lisp Hug - the mailing list for LispWorks users lisp-hug@lispworks.com http://www.lispworks.com/support/lisp-hug.html