From: Michael G. <mic...@im...> - 2004-05-07 15:13:24
|
Hi, I have a problem I don't understand. I defined those 2 C-functions: int myfun3( int *a, int len ) { · int i; · for ( i=0; i<len; i++ ) · · a[ i ] = i; · return 0; } int myfun4( char *a, int len ) { · int i; · for ( i=0; i<len; i++ ) · · a[ i ] = ( char )'a'+i; · return 0; } and I compiled them in a shared lib: libmyfun.so. In LISP, I then use the following calls: (def-call-out myfun3 (:library "libmyfun.so") (:arguments (name (c-ptr (c-array-max int 256)) :out :alloca) (len int)) (:name "myfun3") (:return-type int) (:language :stdc)) (def-call-out myfun4 (:library "libmyfun.so") (:arguments (name (c-ptr (c-array-max char 256)) :out :alloca) (len int)) (:name "myfun4") (:return-type int) (:language :stdc)) Finally I test those 2 functions with code like: (multiple-value-bind (success name) (myfun3 16) (if (zerop success) name 'failure)) (multiple-value-bind (success name) (myfun4 16) (if (zerop success) name 'failure)) The first call (with integer) returns an empty array, while the second call (with char) returns a correctly filled array. The only difference is the element type. Did I miss something??? Please, any comment is welcome, I'm currently lost. Thanks. Michael. |